The front page All those lovely tutorials Other sites of interest More info about Stickman
Stickman

Stop/start button

<IMG SRC="graphics/default.gif" WIDTH=100 HEIGHT=100 BORDER=0>

 TUTORIAL INFO 

Version Flash 3
Difficulty Easy
Created 24th May 1999

 DOWNLOAD 

ZIP

FLA

Somebody on Flashpad asked how to make a single button that could stop and start an animation. Here's the .fla file in .zip form.

And the secret is...

Nothing too complicated here. The animation is a movie clip called ColourAnimation, which has a Stop action at the start to prevent it playing immediately. Then there are two unremarkable buttons (ButtonStart and ButtonStop).

These two buttons are placed in the movie clip ButtonMovie, which only has two frames -- one button in each frame. Again there's a Stop action in the first frame to stop it playing immediately. This movie clip and the colour animation movie clip are placed in the main scene, with the Instance Names button and ColourAnimation respectively.

If you look at the actions of the buttons in ButtonMovie you'll see that they each have two. ButtonPlay uses Tell Target on /ColourAnimation to make it play, and then again to tell /button to go the next frame - thus changing from the 'play' button to the 'stop' button. ButtonStop does much the same, only it uses Tell Target to make /ColourAnimation stop, and /button go back to frame 1 (thus replacing the 'stop' button with the 'play' button once again). So basically you're swapping back and forth between frame 1 and 2 of ButtonMovie.

That's all?

Yep. Good luck!

Stickman

All files and text copyright ©Stickman 1998 - 2003. For copyright and terms of use information, please read this page.