Creating a Stopwatch Program in Flash

Using Actionscript 2.0 To Make a Stopwatch Animation Work

Neil Mey
What You Should Already Have

Animated stopwatch from your 3d program of choice (second moving from 0 to 60 seconds) rendered out as a .png sequence if possible or jpg at 550x400px. All these images should be in one folder.

1. Open flash and create a new action script 2.0 flash document

2. Import your saved targa or png sequence that you rendered from your maya stopwatch animation. File import and chose the first image in the sequence. Flash will then realize it is part of a sequence and ask if you want all of them imported. Press OK.

3. It may take sometime to import but after it is done you will notice 60 keyframes made that have your animated sequence in them. Rename Layer 1 stopwatch . You should have your stopwatch placed on the stage now..

4. Create a new layer in your layer stack and name it actions.

5. On keyframe 1 of your actions layer right click and chose actions.

6. In your actions window type in the following script stop(); or making sure script assist is not clicked chose timeline control stop from the actions left panel menu and close it. What this does is stop the animation from playing automatically

7. We are now going to create a button so that we can turn on our stopwatch. Insert>New Symbol chose button for type and name it invisbutton.

8. You should now see an up, over, down, and hit parts in the timeline for your button. Click on the block in the timeline for Hit and right click. Chose insert blank keyframe..

9. With your Hit keyframe selected draw a square on the stage over top of the cross hair, color does not matter or size..

10. Navigate back to scene 1 and create a new layer and rename it button. Move this layer to the top of the layer stack..

11. Select your button layer and drag your invisbutton onto the stage. Place it over the stopper for the stopwatch. Make sure it is big enough to fit over the stopper. If it is not resize it..

12. Right click on the button on the stage and chose actions. In your actions window make sure script assist has been depressed..

13. Chose timeline control>play and close out the actions pallete to return to scene 1..

14. In your button layer move to frame2 and insert a keyframe.

15. On the stage right click on the button image and chose actions..

16. Make the script assist button is not depressed and change the word play in the script to stop..

17. Close out the actions pallet.

18. We are going to know create a restart button so you can clear out the time. Insert>New Symbol chose button name it clear or restart your choice.

19. create a graphic with the words restart or clear your choice depending on your choice for the previous step.

20. Navigate back to scene 1 and create a new layer and rename it restart or clear.

21. Drag your restart or clear button to the stage making sure you are on your restart/clear layer. Place it on the stage in an appropriate place..

22. Right click on your restart/clear button and chose actions.

23. In your actions window select scrip assist and then double click on timeline control>goto
Select gotoandstop and change the following
scene: current scene
type: Frame Number
frame: 1
close out of the window

24. Save your flash file and do file>publish preview to test it. .

Published by Neil Mey

My name is Neil Mey. I am from Saint Louis Missouri and have a Master of Arts degree in Communications from Lindenwood University. I am currently an Instructor at Lindenwood University as well.  View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.