Task: Backward Movie Clip

I l @ ve RuBoard

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.

  1. Start a new movie. Place a simple, animated movie clip on the screen. You can use the "gear animation" from the previous example.

    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.

  2. Select the movie clip and bring up the Actions panel. The title of the Actions panel should be ActionsMovie Clip.

  3. 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:

     onClipEvent (load) {     gotoAndStop(60); } 

    This handler is called only once, when the movie clip first appears.

  4. The second handler is an onClipEvent (enterFrame) handler that executes once per frame. It pushes the movie clip to the previous frame:

     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.

I l @ ve RuBoard

Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net