Task: Backward Movie Clip
For now, let's write a simple movie clip script that demonstrates how it works. We'll make a movie clip run backward.
We will start the movie clip at the last frame and then use a prevFrame command to send the clip back one frame at a time.
-
Start a new movie. Place a simple, animated movie clip on the screen. You can use the "gear animation" from the previous example.
-
Select the movie clip and bring up the Actions panel. The title of the Actions panel should be ActionsMovie Clip.
-
Two handlers are in this script. The first one is an onClipEvent (load) handler that sends the movie clip to the last frame, in this case frame 60:
-
The second handler is an onClipEvent (enterFrame) handler that executes once per frame. It pushes the movie clip to the previous frame:
In this case, it doesn't matter what you name the movie clip. We will never need to refer to it by name because the script will be attached directly to the movie clip.
onClipEvent (load) { gotoAndStop(60); }
This handler is called only once, when the movie clip first appears.
onClipEvent (enterFrame) { prevFrame(); }
Test the movie to see it in action. In the example movie, 06reverse.fla, you can see the same "gear animation" animation play backward.