Hello!
Im trying to figure out a way to add frames to a movie clip timeline with AS3. The number of keyframes that will be added depends on user input so i can not set them in advance. Is there a way to do this? Im using AS3.
may be i am thinking wrong
here is the scenario
Im trying to figure out a way to add frames to a movie clip timeline with AS3. The number of keyframes that will be added depends on user input so i can not set them in advance. Is there a way to do this? Im using AS3.
I want the user to be able to load a couple of images (unknown amout) and then "play" through these images as an animation. You should also be able to pause and resume the animation. The loading works fine (getting all the URLs into an array etc) but the next part is trickier.
plz tell me if u have better solution?
Thanks
You can use an empty MovieClip for that
Basically, create an empty MovieClip with as many frames as you need (depending on your fps, obviously) to act as some sort of timer. Adobe's default Timer cannot "pause", it can only "stop", so I don't recommend it for the task at hand.
Let's say you create a MovieClip named "mc_timer" with 24frames in it. With 24ffps, this means the image changes every second. Convert the 24th frame into a keyframe, and have it call for a function in root that will advance the slide
Let's say you have this code in root (that is the very top level)
function advancePhoto():void
{
//do your image changing routine here
}
At the 24th frame of your "mc_timer", put this:
MovieClip(root).advancePhoto();
Then, just play mc_timer. Every 24 frames it will call for "advancePhoto" function. To "pause" the slideshow, simply call mc_timer.stop(), the playhead will stay put (simulating a pause), and to resume just call mc_timer.play(), the playhead will start playing from its current position
With this, the photo can change indefinitely without anywork on your part. Just make sure you stop the mc_timer in case you don't need it anymore
North America
Europe, Middle East and Africa
Asia Pacific