Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

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.

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

  2. 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.

  3. Select the movie clip and bring up the Actions panel. The title of the Actions panel should be Actions—Movie Clip.

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

  5. onClipEvent (load) {
      gotoAndStop(60);
    }

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

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

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

  • + Share This
  • 🔖 Save To Your Account