Archive
This is an archived tutorial about Flash. It's kept for history and may reference outdated tech.
TL;DR
To let viewers pause and resume an animation, add a Pause button whose on (press) handler calls stop() and a Play button whose on (press) handler calls play(). The example animation morphs a blue square into an orange circle, and pressing Pause freezes it on the current frame.
- stop() tells the animation to stop on its current frame.
- play() tells the movie it can start running again from where it stopped.
- Keep your own designs within the animations layer and place the two buttons on the Button layer.
- If it doesn't work, finish the tutorial as written first, then make it your own way.
Ever wanted
to pause at the best bit in your animation? Or maybe let the
viewer pause, and look in detail at your well crafted
animation? Well in this tutorial, I shall be showing you how
to add a Pause, and play button into your animation!
[This is what you will be creating]
How To Make It Happen
- Firstly,
download and open the .FLA
file into flash. This will have the bare bones of what we
need to make in the example. If you wish to not use the
example at all, this will also be very easy to do, and i
shall explain what to do along the way. We now have to go
to our library folder, so go to Window/ Library, or press
CTRL+L to access it alternatively. Now drag and drop the
two buttons into place in the Button layer, and put them
where you feel necessary*.
- Now that we
have the animation open, you will see that I have already
created the animation for you! This is where, if you are
not following the example file, you can go wild and create
something really cool and special! But please make sure to
stay within the animations layer.

[ Try to stay only within the animations layer for your designs]
- We now have to go to our library folder, so go to Window/ Library, or press CTRL+L to access it alternatively. Now drag and drop the two buttons into place in the Button layer, and put them where you feel necessary*.
[*If you are not following the .FLA File , You should create two buttons called Play and Pause]
- You now have to highlight the Pause button, and input this code into the Actions Panel.
- on (press) {
- stop();
- }
-
Highlight the Play button and input this code into the Actions panel
- on (press) {
- play();
- }
- Time to test your animation. You should see a blue square morph into an orange circle and back again, and if you press the pause button, it should stop the animation on its current frame, then press play to resume the action.
Congratulations! You have just
incorporated buttons into your animation!
The Theory
- on (press) {
- stop();
- }
What this does, is it tells the animation to stop on it's current frame. OnRelease tells us that, when the button is released, it will do the next command. The next command is Stop(); which tells it to stop on the current frame.
- on (press) {
- play();
- }
This tells the movie to play again. As explained above, OnRelease tells the button that, once it is released, it should do the next command. Play(); tells the animation that it can start to run again.
|
|
Note | |
|
||
You can download the final source also:
|
Hope you enjoyed the tutorial, and for extra advice,
try the kirupa.com forums.
Thanks for reading!
|
|
Blabj By Default |
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, Masking Dynamic Text and Device Fonts, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy kirupa's books, became a paid subscriber, watch the videos, and/or interact on the forums.
Your support keeps this site going! 😇
-
Hot off the Forums
:: Copyright © KIRUPA 2026 //--
