MovieClip to NetStream
Hi. How can i stream a movieclip such as video? Is it
possible? I really need this, please someone help me if knows
somethings. Thanks.
Hi glenn. Thanks for answer. Actually i know to use
ShareObject library but it will not work for me about what i trying
to do. I m working on a tv project, actually it is done. But we
want to also record the broadcast if it is live for example. But we
have also character generator for typing somethings bottom of
broadcast on a band, and when we want to record, we can just record
the video stream, not with band. So the only way to do that,
MovieClip Streaming i think. If i can do that, it will be perfect.
Thanks again.
Regards.
Similar Messages
-
Sending metaData with netStream.send is not working
I'm trying to send metaData from client to FMS server when recording Webcam video and have implemented sending of metaData as stated on Adobe's help page at: http://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d5 6e-7ff6.html
However when I play the recorded video from FMS, my custom metaData properties trace "undefined". I can trace default metaData properties such as duration or videocodecid successfully, but not my custom properties such customProp, width or height. Here is part of my code that is related to the issue:
private function ncNetStatus(event:NetStatusEvent):void {
if (event.info.code == "NetConnection.Connect.Success") {
ns = new NetStream(nc);
ns.client = this;
ns.publish(webcam_test, "record");
private function netStatus(event:NetStatusEvent):void {
if (event.info.code == "NetStream.Publish.Start") {
sendMetadata();
private function sendMetadata():void {
trace("sendMetaData() called...");
myMetadata = new Object();
myMetadata.customProp = "Welcome to the Live feed of YOUR LIFE";
ns.send("@setDataFrame", "onMetaData", myMetadata);
public function onMetaData(info:Object):void {
trace('videocodecid: ',info.videocodecid); //returns 2
trace('customProp: ',info.customProp); // returns undefined
And here is my trace result:
NetConnection.Connect.Success
NetStream.Publish.Start
sendMetaData() called...
NetStream.Record.Start
Stopped webcam recording...
NetStream.Record.Stop
NetStream.Unpublish.Success
NetStream.Play.Reset
NetStream.Play.Start
videocodecid: 2
customProp: undefinedHere is the working code which I have tried at my end. You can see the highlighted line in which the second parameter is 0 which means it will play only recorded stream:
package {
import flash.display.MovieClip;
import flash.net.NetConnection;
import flash.events.NetStatusEvent;
import flash.events.MouseEvent;
import flash.events.AsyncErrorEvent;
import flash.net.NetStream;
import flash.media.Video;
import flash.media.Camera;
import flash.media.Microphone;
import fl.controls.Button;
import fl.controls.Label;
import fl.controls.TextArea;
public class Metadata extends MovieClip {
private var nc:NetConnection;
private var ns:NetStream;
private var nsPlayer:NetStream;
private var vid:Video;
private var vidPlayer:Video;
private var cam:Camera;
private var mic:Microphone;
private var clearBtn:Button;
private var startPlaybackBtn:Button;
private var outgoingLbl:Label;
private var incomingLbl:Label;
private var myMetadata:Object;
private var outputWindow:TextArea;
public function Metadata(){
setupUI();
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.connect("rtmp://localhost/publishlive");
* Clear the MetaData associated with the stream
private function clearHandler(event:MouseEvent):void {
if (ns){
trace("Clearing MetaData");
ns.send("@clearDataFrame", "onMetaData");
private function startHandler(event:MouseEvent):void {
displayPlaybackVideo();
private function onNetStatus(event:NetStatusEvent):void {
trace(event.target + ": " + event.info.code);
switch (event.info.code)
case "NetConnection.Connect.Success":
publishCamera();
displayPublishingVideo();
break;
case "NetStream.Publish.Start":
sendMetadata();
break;
private function asyncErrorHandler(event:AsyncErrorEvent):void {
trace(event.text);
private function sendMetadata():void {
trace("sendMetaData() called")
myMetadata = new Object();
myMetadata.customProp = "Welcome to the Live feed of YOUR LIFE, already in progress.";
ns.send("@setDataFrame", "onMetaData", myMetadata);
private function publishCamera():void {
cam = Camera.getCamera();
mic = Microphone.getMicrophone();
ns = new NetStream(nc);
ns.client = this;
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.attachCamera(cam);
ns.attachAudio(mic);
ns.publish("myCamera", "record");
private function displayPublishingVideo():void {
vid = new Video(cam.width, cam.height);
vid.x = 10;
vid.y = 10;
vid.attachCamera(cam);
addChild(vid);
private function displayPlaybackVideo():void {
nsPlayer = new NetStream(nc);
nsPlayer.client = this;
nsPlayer.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nsPlayer.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
nsPlayer.play("myCamera",0);
vidPlayer = new Video(cam.width, cam.height);
vidPlayer.x = cam.width + 100;
vidPlayer.y = 10;
vidPlayer.attachNetStream(nsPlayer);
addChild(vidPlayer);
private function setupUI():void {
outputWindow = new TextArea();
outputWindow.move(250, 175);
outputWindow.width = 200;
outputWindow.height = 50;
outgoingLbl = new Label();
incomingLbl = new Label();
outgoingLbl.width = 150;
incomingLbl.width = 150;
outgoingLbl.text = "Publishing Stream";
incomingLbl.text = "Playback Stream";
outgoingLbl.move(30, 150);
incomingLbl.move(300, 150);
startPlaybackBtn = new Button();
startPlaybackBtn.width = 150;
startPlaybackBtn.move(250, 345)
startPlaybackBtn.label = "View Live Event";
startPlaybackBtn.addEventListener(MouseEvent.CLICK, startHandler);
clearBtn = new Button();
clearBtn.width = 100;
clearBtn.move(135,345);
clearBtn.label = "Clear Metadata";
clearBtn.addEventListener(MouseEvent.CLICK, clearHandler);
addChild(clearBtn);
addChild(outgoingLbl);
addChild(incomingLbl);
addChild(startPlaybackBtn);
addChild(outputWindow);
public function onMetaData(info:Object):void {
outputWindow.appendText("Custom Prop : " + info.customProp);
trace("Custom Prop : " + info.customProp);
trace("Videocodecid : " + info.videocodecid);
trace("Creation Date : " + info.creationdate);
Hope this solves your query and if still you have the issue then please tell the version of FMS and Player you are using.
Regards,
Amit -
Load random FLV with NetStream
Dear Adobe members,
I'm puzzeling for days on this one. I'm a bit of a noob so please help me
I want to create a videowall in a grid of 7 x 7 flv's.
In this grid, the flv's have to be loaded at random and when finished, a new
random flv has to be loaded and played.
I've come so far that I have a MovieClip that loads an flv at random and then
loops it, but it loops the same video, not a random new one.
Can anybody help me out please?!
The code:
var video:Video = new Video();
addChild(video);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = {onMetaData:ns_onMetaData, NetStatusEvent:ns_onPlayStatus};
var video_array = new Array("Scenes/001.flv", "Scenes/002.flv", "Scenes/003.flv", "Scenes/004.flv");
// Function that gets a random video from the array
function getRandomVideo():String {
return video_array[Math.floor(Math.random() * video_array.length)];
video.attachNetStream(ns);
ns.play(getRandomVideo());
function ns_onMetaData(item:Object):void {
// Resize video instance.
video.width = item.width;
video.height = item.height;
// Center video instance on Stage.
video.x = (stage.stageWidth - video.width) / 2;
video.y = (stage.stageHeight - video.height) / 2;
//loop the video
function ns_onPlayStatus(event:NetStatusEvent):void {
if(event.info.code == "NetStream.Play.Stop"){
ns.seek(0);
ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus);
Thanks!For those who want to know how I solved it:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.bufferTime = 0;
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
var video_array = new Array("Scenes/001.flv", "Scenes/002.flv", "Scenes/003.flv", "Scenes/004.flv");
// Function that gets a random video from the array
function getRandomVideo():String {
return video_array[Math.floor(Math.random() * video_array.length)];
ns.play(getRandomVideo());
var vid:Video = new Video(182,137);
vid.attachNetStream(ns);
addChild(vid);
function asyncErrorHandler(event:AsyncErrorEvent):void{
// ignore error
// loop video
ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus)
function ns_onPlayStatus(event:NetStatusEvent):void{
if(event.info.code == "NetStream.Play.Stop"){
ns.play(getRandomVideo());
ns.seek(0); -
Hi, I'm building a video player which loads .flvs into a
movie clip from a menu and places the movie clip on the stage using
getNextHighestDepth. Everything works great except the client would
like the viewer to be able to leave clip A, view clip B and return
to the last viewed point in the A clip's timeline. Is this possible
without getting into a serverside streaming application? Would I
need to create multiple movieclips with embedded video objects, and
start swapping depths on the stage? Or can it be done with multiple
netStream objects? Thanks for any guidance.I'm working on a chat app that shows up to 10 live cams at a
time in one swf. When a user joins the room the publish through a
separate connection, but all of the subscribes are through one
connection - I thought it would help to minimize connections to the
server to stream through one connection.
Is it recommended to separate these out into individual
connections? -
How to close NetStream in class script
How to close NetStream in class script
I use NetStream action to play the video. It’s working perfectly. Want to know how I can close my NetStream video to clicking on the button as in class scrip. I tray this
ns.close();
but got error
NetStream class action
package {
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.SoundTransform;
import flash.display.MovieClip;
public class clickbutton extends SimpleButton {
var ns:NetStream;
var previousVolume:Number = 1;
public function clickbutton() {
this.addEventListener(MouseEvent.CLICK, clickF);
private function clickF(e:MouseEvent):void{
MovieClip(this.root).gotoAndStop(2, "Scene 1");
var nc:NetConnection=new NetConnection();
nc.connect(null);
ns=new NetStream(nc);
var video:Video=new Video(320, 200);
video.x=(stage.stageWidth-320)/2;
video.y=(stage.stageHeight-200)/2;
ns.client=this;
this.parent.addChild(video);
video.attachNetStream(ns);
ns.play("video_test.flv");
controlsF();
this.removeEventListener(MouseEvent.CLICK, clickF);
this.parent.removeChild(this);
private function controlsF():void{
MovieClip(root).play_btn.addEventListener(MouseEvent.CLICK,playF);
MovieClip(root).pause_btn.addEventListener(MouseEvent.CLICK,pauseF);
MovieClip(root).muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);
// add volume listener here. you'll need to decide how you want to control volume.
function playF(e:MouseEvent):void{
ns.resume();
function pauseF(e:MouseEvent):void{
ns.pause();
function muteF(e:MouseEvent):void{
if(ns.soundTransform.volume>0){
var st:SoundTransform=ns.soundTransform;
previousVolume=st.volume;
st.volume=0;
ns.soundTransform=st;
} else {
st=ns.soundTransform;
st.volume=previousVolume;
ns.soundTransform=st;
public function onMetaData(eobj:Object): void {
// this needs to be in the scope of your loader
public function onPlayStatus(eObj: Object): void {
public function onXMPData(eobj:Object):void{I make to keyfram in my time line.
In 1st keyfram on the video button I use this code
package {
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.SoundTransform;
import flash.display.MovieClip;
public class palyvideo extends SimpleButton {
var ns:NetStream;
var previousVolume:Number = 1;
public function palyvideo() {
this.addEventListener(MouseEvent.CLICK, clickF);
private function clickF(e:MouseEvent):void{
MovieClip(this.root).gotoAndStop(2, "Scene 1");
var nc:NetConnection=new NetConnection();
nc.connect(null);
ns=new NetStream(nc);
var video:Video=new Video(320, 200);
video.x=(stage.stageWidth-320)/2;
video.y=(stage.stageHeight-200)/2;
ns.client=this;
this.parent.addChild(video);
video.attachNetStream(ns);
ns.play("video_test.flv");
controlsF();
this.removeEventListener(MouseEvent.CLICK, clickF);
this.parent.removeChild(this);
private function controlsF():void{
MovieClip(root).play_btn.addEventListener(MouseEvent.CLICK,playF);
MovieClip(root).pause_btn.addEventListener(MouseEvent.CLICK,pauseF);
MovieClip(root).muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);
// add volume listener here. you'll need to decide how you want to control volume.
function playF(e:MouseEvent):void{
ns.resume();
function pauseF(e:MouseEvent):void{
ns.pause();
function muteF(e:MouseEvent):void{
if(ns.soundTransform.volume>0){
var st:SoundTransform=ns.soundTransform;
previousVolume=st.volume;
st.volume=0;
ns.soundTransform=st;
} else {
st=ns.soundTransform;
st.volume=previousVolume;
ns.soundTransform=st;
public function onMetaData(eobj:Object): void {
// this needs to be in the scope of your loader
public function onPlayStatus(eObj: Object): void {
public function onXMPData(eobj:Object):void{
In 2nd keyfram I use this code on reply button
package {
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.media.SoundMixer;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class reply extends SimpleButton {
public function reply() {
this.addEventListener(MouseEvent.CLICK,clickFF);
private function clickFF(e:MouseEvent):void{
SoundMixer.stopAll();
MovieClip(this.root).gotoAndStop(1, "Scene 1");
ns.close();
//video.attachNetStream(null);
But when I click on reply button I got this compiler error -
Latency (sync VideoElement with MovieClip)
Hi,
I have a MovieClip witch contain several visuals elements, movieclip
timeline must be sync with VideoElement.
To do that, I start movieclip timeline when BUFFERING mediaplayer state
is false, each 10 ms, I check if visual timeline needed to be resync
whith mediaPlayer.currentTime (if time difference is equal or greater
than 20 ms)
The problem is : on Windows there is a latency witch affect the user
experience, on mac it works like a charm.
I use FLash CS5 and Flex SDK 4.5 + Flash Player 10.2
This is my code (sample) :
_videoElement = new VideoElement( null, new HTTPStreamingNetLoader());
_parallelElement = new ParallelElement();
_parallelElement.addChild(_videoElement);
_mediaPlayer = new MediaPlayer(_parallelElement);
_mediaPlayer.currentTimeUpdateInterval = 10;
_mediaPlayer.addEventListener(TimeEvent.CURRENT_TIME_CHANGE,
currentTimeChangeHandler);
_mediaPlayer.addEventListener(BufferEvent.BUFFERING_CHANGE,
bufferingChangeHandler);
_mediaPlayer.play();
function bufferingChangeHandler(event:BufferEvent):void
if(!event.buffering)
timeline.play();
else
timeline.pause();
function currentTimeChangeHandler(event:TimeEvent):void
//check if timeline need to be sync
var timelineInterval:Number = timeline.currentTime -
_mediaPlayer.currentTime;
if (Math.abs(timelineInterval) > 0.2 )
timeline.currentTime = _mediaPlayer.currentTime;
Timeline is ALWAYS sync. But visually we can see timeline in advance of
the video, probably because of latency or less depending on the system.
*** Sometimes I got 150 ms, sometimes 50ms. ***
on Mac is always less than 30 ms
If i use HTTPStreamingNetLoader NetStream.appendBytes() is used no ? so latency should be better ?
What can I do to have a latency close to 0 in any environment ?
Thanks !!Nobody can help me ? :/
-
Loading video into existing movieclip
Hi all,
I am using the following code to load an external flv.
var video:Video = new Video();
addChild(video);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = {onMetaData:ns_onMetaData, onCuePoint:ns_onCuePoint};
function ns_onMetaData(item:Object):void {
// video.width = 370;
// video.height = 250;
video.x = 525;
video.y = 88;
function ns_onCuePoint(item:Object):void {
video.attachNetStream(ns);
ns.play("sfmekransu.flv");
But i want the movie to be loaded into my movie clip object that already created. How can i do it?Hi,
add the video to your movieclip:
movieclip.addChild(video);
Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com/ -
Netstream commands not working
I have a base movie, "impression.swf", it loads into a
movieClip a movie called "flvLoader.swf". Inside of the file
"flvLoader" is this code:
The movie just plays without waiting for the
"NetStream.Buffer.Full" command to come up. By the time the trace
reads "NetStream.Buffer.Full" it is already playing. Also, I am
using "NetStream.Buffer.Empty" to advance the timeline, which is
obviously a bad idea, but it is the only thing that comes up from
the onStatus at the end of the movie playing.
I have added out points in Sorenson Squeeze 4.5.3 to all the
movies, but I never receive the "NetStream.Play.Stop" command in
the trace. So as of now I have no way to make the _root timeline
advance when the movie is finished playing outside of
"NetStream.Buffer.Empty". I have also tried using onMetaData
ns.duration and ns.time, but the ns.time never reaches the ending
time, so the movie never advances.
I have read some forums on glitches with this code. Does
anyone have a solution? Very frustrated, any help is much
appreciated.Some laptops/tablets have a feature to lock the alt, function and ctrl keys.
Do you have another keyboard to test if the alt key is stuck, or better yet, does it work in other programs?
If it does work then it could be your preference file is corrupted and guess what key is require to reset the preference file, ctrl-alt-shift when starting photoshop.
As for the tools, they can be reset separately
In the top tool bar at far left side is an icon of the tool selected, click on it to bring up the tool dialog box. Then in the upper right hand corner of that dialog box is a small icon click on that to bring up a menu. Just choose reset tool or reset all tools.
Or right click on the tool icon in the top tool bar and rest tool and reset tools will show by them selves. (Just figured that one out - so I don't know how old that feature is) -
Coercing string to MovieClip class
I've been learning coercion between String and Number and
simple stuff, but now I have a class that the books don't cover.
This is best explained by example (this isn't the end goal, just a
learning example).
On the stage in frame 1, I have a MovieClip instance named
shape_mc.In your first post you create a variable fubar with no
particular type and then make it a String by concatenating two
other variables. Next you attempt to cast String to MovieClip -
this is what is wrong with the code. Casting works only if an
object somehow is related to other object - in this instance if
fubar data type was related somehow to MovieClip (by extension for
example).
In order to use a string to point to an object - you need to
use an associative array syntax:
parentObject["string"] - given that an object "string" is in
the scope of parentObject.
The following syntax will work (if the movieclip is in the
scope of "this"):
var pre:String="shape";
var suf:String="_mc";
var fubar:* = MovieClip(this[pre + suf]);
Again, the key is to use a correct scope.
As for the flv files, there is no need to cast at all. FLVs
are not MovieClips. It is not clear how you want to play FLVs. Are
they on the server? If so - you need the url to them only (which
are strings). If they are progressive (downloaded via http) your
code may look something like:
var flvURL:String;
function clickListener(e:MouseEvent):void{
flvURL = e.target.name.toString().split("_")[0] + "_flv";
//some time later:
netStream.play(flvURL);
Of course this is just a concept - real code should be
different. -
Problem of defining value to a textfield in MovieClip
hello,dear everyone
there is problem that realy confused me.that is the
textfield(or other display objects) in MovieClip can't be defined
when i jumpto that frame.check these simple code:
mc.stop()
function goNext(evt:Event){
mc.nextFrame()
dosth()
function dosth()
if(mc.currentFrame==2)
mc.mytext.text="hello"
nextBT.addEventListener("click",goNext)
the mc is a simple MC that have 2 frames,and the textfield
object is in the second frame.
and what i try to do is when i clicked the button,the mc
jumpto the second frame.and i define a value to that textfield.but
it's failed when i try to do like that.
as i debug the program.i found that when i define the value
to the textfield,that textfield is a Null Object(should be the
TextField object).not only the textfield not work,but also other
elements such as Button objects.
so,i am thinking that must because the objects are too late
to initialized before they be used.maybe there are some event can
tell me that all elements has been initialized,as i can use them
then.what do you think,my friend?If all of the code you have is in the first frame, then it
has processed long before anything ever moved to the second frame.
What you could try is to have a variables layer that extends
both frames, and assign the value of the textfield text to that
variable. Make the textfield associate with that variable (in the
properties section for it), So when the movieclip moves to the
second frame the text field should automatically acquire the
variable value.
I may not have interpretted your problem correctly, so you
might have to clarify things if I missed the target. -
Audio Streaming with NetStream on LCDS or FDS
Hi. I can't make audio streaming working on FDS neither on
LCDS. I want to record audio on server.
When trying to :
quote:
new NetStream(this.netConnection);
i get
quote:
01:19:48,140 INFO [STDOUT] [Flex]
Thread[RTMP-Worker-2,5,jboss]: Closing due to unhandled exception
in reader thread: java.lang.IndexOutOfBoundsException: Index: 0,
Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at
flex.messaging.io.tcchunk.TCCommand.getArg(TCCommand.java:260)
at
flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(AbstractRTMPServer.java: 821)
at
flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPConnection.java:424 )
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPo olExecutor.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolEx ecutor.java:690)
at java.lang.Thread.run(Unknown Source)
The same code works fine on RED5.
What's wrong?
RTMP channel definition is :
quote:
<channel-definition id="my-rtmp"
class="mx.messaging.channels.RTMPChannel">
<endpoint uri="rtmp://{server.name}:2040"
class="flex.messaging.endpoints.RTMPEndpoint"/>
<properties>
<idle-timeout-minutes>20</idle-timeout-minutes>
<client-to-server-maxbps>100K</client-to-server-maxbps>
<server-to-client-maxbps>100K</server-to-client-maxbps>
</properties>
</channel-definition>There are seeral apps that play music over wifi or 3G
Pandora, I(heart)music, Bing100, all free, -
Multiple Animations for a single MovieClip sprite
Ok, after hours of exhausting searching, and having to learn how to animate a simple sprite for the 100th time, I hope I might found I more specific, and better explained answer to my problem.
I'm trying to make a flash game, of course, and I want my main Player sprite to be able to play multiple animations based on specific input. So, a running right animation, a running left animation, a jump animation, and an attack animation.
At the moment, the most I can seem to achieve is to create a single timeline, with a default frame in the exact middle. Then when player holds left, it plays the previous frame, or scrolls backwards through the timeline. When the Right key is held, it plays forward from the default middle.
It's ugly and extremely limited. I've tried using the gotoAndStop() and gotoAndPlay() methods, but because the statement checking for the key being pressed is constantly being checked, it will stay on the frame chosen for those methods, rather than move forward along the time line.
I would greatly appreciate a better method for this, or a more specific tutorial to achieve the goal i'm looking for.
I've seen mention of the attachMovie() method, but I can not find an understandable explanation of how to properly use it in the way I desire.
essentially, the sprite will have the default standing frame while no keys are pressed. Then, if the right key is down, it plays the running right animation. When the left key is down, it plays the running left animation. When the jump key is pressed, it plays the jump animation. And when the attack key is pressed, it plays the attack animation.
I hope that's enough information and that it's understandable, if not, let me know what more you need to know and I'll do my best to explain it more.You can do this a number of ways but I will try to explain the what I think is the easiest.
Step 1
Draw a box on the stage
Step 2
convert this into a movieclip (F8), name this myCharacter (or anything you want really), then press ok. Now select this movieClip and in the properties dialogue box, type "box", again, without the quotes. Then press enter.
Step 3
Double click this new movieClip (this should take you into this movieClip timeline)
Step 4
Now press F6, 3 times. This wil give you 3 additional key frames on this timeline. You should now have 4 key frames.
|Step 5
Select key frame 1 on this timeline and press F8. Type into the diag box "standing", without the quotes. Then select the Movie Clip radio button, if it is not already selected.
Step 6
Step 12
Make sure your library is in view, if not Ctrl+L. You should see the movement clips you created, running_right, running_left, etc. Double Click any one of these and add the animation your want in these movs.
There we go, simples.....Test you animation and see how you are doing.
Select key frame 2 on this timeline and press F8. Type into the diag box "running_right", without the quotes. Then select the Movie Clip radio button, if it is not already selected.
Step 7
Select key frame 3 on this timeline and press F8. Type into the diag box "running_left", without the quotes. Then select the Movie Clip radio button, if it is not already selected.
Step 8
Select key frame 4 on this timeline and press F8. Type into the diag box "jumping", without the quotes. Then select the Movie Clip radio button, if it is not already selected.
Great, once you have done this, these new movieClips should now have appeared in your library (press Ctrl+L if you cannot see your library)
Ok then you have just created your movement MovieClip. You now need to get back to the main timeline. You can just keep on clicking the stage to get back to this location. Once there you need to select the box you have just created and name this "box" for the time being.
Ok then a little bit of programming now.
Step 9Create a new layer in the timeline and name it scripts.
Step 10Then select this layer and press F9 on your keyboard. THis should bring up the scripting pane for this frame.
Step 11Type in the following code
box.stop();// when you run this animation, this command will stop your box from doing anything
var keyBoardListener:Object = new Object();// Creates a new Object for the keyboard presses
keyBoardListener.onKeyDown = function() {
if (Key.isDown(Key.LEFT)) {// runnning LEFT action
_root.box.gotoAndStop(3);// Frame where the running right animation is
} else if (Key.isDown(Key.RIGHT)) {// running RIGHT action
_root.box.gotoAndStop(2);// Frame where the running right animation is
} else if (Key.isDown(Key.UP)) {// JUMPING action
_root.box.gotoAndStop(4);// Frame where the JUMPING animation is
keyBoardListener.onKeyUp = function() {
_root.box.gotoAndStop(1);// When the keys are released, this action takes your animation back to frame 1, where your character is just standing still.
Key.addListener(keyBoardListener);// this assigns the listener to your key press detection Object.
Step 12
Edit the action movs within your library by double clicking each one and adding movement to each. Then test your animation. -
MovieClip Hit area doesn't work properly. I have two
movieclip's next to each other, one is button mode true, but the
hit area isn't correct.
Here is my .fla file (just an example, very simple) -
http://www.speedyshare.com/831305914.html
, just open and test the movie, you see it (then you roll over it
should fade in into blue and at mouse roll out it should fade out
back to white, but on "o" and a lit of bit on "m" hit area is
wrong).
How to fix this?I really don't know guys.
-
Export animation to SWF and plays as MovieClip
Hi to EveryBody.
We are evaluating the Rome AIR applicaction in order to create presetations and swf animations.
We have made an animation, the Anim Clips Animation, without anything more.
We have exported to SWF (Flash Player Compatible) and everything went ok.
We have a special player made in flex that plays de SWFs Casting it as a MovieClip and when the object is Casted the result is a null object.
We have had this problems with SWFs compiled with flash player in AS2 but if it was compiled in AS3 it works.
Any idea or solutions.
Thanks
The player Code for Flash Builder 4: When you click the button de conversión is realized and the movie variable is null.
<?xml version="1.0"?>
<!-- controls\swfloader\SWFLoaderSimple.mxml-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
function convert():void{
var movie:MovieClip = player.content as MovieClip;
movie.gotoAndPlay(1);
]]>
</fx:Script>
<s:VGroup>
<mx:SWFLoader source="Rome.swf" id="player"/>
<s:Button label="Convert" click="convert()"/>
</s:VGroup>
</s:Application>Fixed Layout EPUB files support most of the animation you can do in InDesign.
https://indesignsecrets.com/lynda-com-course-creating-fixed-layout-epubs-indesign-cc.php -
How do I use a button within a movieclip to go to the root?
Hi there, I am new to flash and AS3 and need some help
getting my buttons to work.
I made a script for the file that i am working with that has
buttons located within 2 movieclips. I want that button to load and
image into a UILoader (problemLoader_mc) that I placed on the stage
on the main timeline (the timeline that contains WeekBar_mc). The
problem is that I don't know how to get to the root of the file to
start a new directory to tell my function to load the image i want.
I have tried multiple approaches including:
MovieClip(root).problemLoader_mc.source = problemArray[0]
MovieClip(parent).problemLoader_mc.source = problemArray[0]
root.problemLoader_mc.source = problemArray[0]
parent.problemLoader_mc.source = problemArray[0]
(root as MovieClip).problemLoader_mc.source = problemArray[0]
If anyone can help me out with this, I would greatly
appreciate it, I am banging my head against a wall at the moment.
(Also, please excuse my vague descriptions, I am still learning the
official terms.)
Here is the code that I have written that pertains to this
problem:I have a mental block for reasoning things out as far as
assigning the listener to an object two mc's away from the main
timeline while having the function in the main timeline, so I may
play with that on my own for awhile. One thing you didn't do
though, was to pay the same attention to the problemArray[0]
assignment in that function, which I assume also lives in the root.
But here's what I'd do for the moment.
Take all that code except the array and plant it in the
timeline where WEEK1btn lives, modifying it as follows....
WEEK1_btn.addEventListener(MouseEvent.CLICK, pload1);
function pload1(event:Event)
MovieClip(this.parent.parent).problemLoader_mc.source =
MovieClip(this.parent.parent).problemArray[0];
I haven't utlized root myself yet, so I am not comfortable
offering you a solution that attempts it.
Maybe you are looking for
-
Query related to multiple attachments in mail adapter
Hi, I have a query related to multiple attachments in receiver mail adapter. I have successfully configured mail related scenarios but now I have another requirement in which I have multiple source files in one directory and I want to send one mail f
-
Executing a native process and getting the text output
Hi, I have the following problem. When I execute a native DOS process (lets say a batch file), and expect some text output from this process I use the following code: String command = "test.bat"; Process process = runtime.exec(command); BufferedReade
-
Hi, When i am executing a report its displaying , "User master record is not sufficiently maintained for object auth on". Its a authorization issue. Please suggest how to solve this.
-
Nokia PC Suite installation error - how to uninsta...
Hi, New here. Recently bought E51 with Nokia PC Suite 6.85.14.1 provided. I use Windows XP Professional Edition SP 2. I have a previous version of the Suite installed (6.4.8). I tried to uninstall (before installing the new version). After uninstalli
-
Exporting subtitles, OR changing from PAL to NTSC
Hi, folks. I've made a DVD in PAL with full subtitles. I created the subtitles in Encore. My client now needs an NTSC copy of the disk. I can easily rebuild the menu, but retyping the subtitles will take an age! Is there a way to export the subtitles