Printer Friendly Version

BellaOnline's Flash and Animation Editor

Stopping Animation with ActionScript 3

In the last tutorial, we added the second line of text to our ecard FlashR animation. If you test the animation, you will see that the "Happy Thanksgiving" text drops down and bounces on the stage followed by the "From Our House To Yours" text sliding in from the right.

However, we barely have time to read the second line of text before the animation repeats. We have three options to solve this problem. We could add a stop code that will stop the animation on the last frame. A second option is to add a free more blank frames to the animation in order to allow the text to display for a few seconds before the animation repeats. The third option is to stop the animation, as in the first option, but also add a replay button. Because option three incorporates the other two options, it's a good choice for a tutorial.

Open your ecard animation into Flash CS4.

  1. We will first add a few blank frames at the end of the Timeline. Our last frame is 89, let's add 16 blank frames which will give us a total of 105 frames. On the Background layer, right-click on Frame 105 and choose Insert Frame.

  2. On the Happy Thanksgiving 2 layer, right-click on Frame 105 Insert a Frame.

  3. We also need to extend the From Us layer. On Frame 89, select the text and click Edit - Copy. Now add a new layer named "From Us 2". On Frame 90, insert a Keyframe and then click Edit - Paste In Place. Still on this new layer, right-click on Frame 105 and Insert a Frame.

  4. Test your movie and you will be able to see the text for the extra 15 frames before it repeats.

  5. Our next step is a stop the movie on Frame 105. We need to add an Actions layer on the Timeline. Add a new layer at the top of the Timeline and name it "Actions". On this Actions layer and on Frame 105, right-click and add a Keyframe. Open the Actions panel (Window Actions). Type in the following code.


That takes care of the first two options. Now we are ready to add a replay button.

← Back

Join us in the Flash forum.

Flash and Animation Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.

| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2018 Minerva WebWorks LLC. All rights reserved.

BellaOnline Editor