ActionScript 3.0 Stop Command | Flash CS6

This entry is part 9 of 11 in the series Flash CS6 Tutorial

As you would have noticed, the animation keeps looping i.e. if begins again once the last frame is reached.

If we want to stop the animation after it has completed we would need to give an ActionScript 3.0 command.

To do this:

1. Create a new layer on the timeline by clicking on the new ‘New layer’ icon at the bottom left of the Timeline window.

A new layer name ‘Layer 2′ will be created.

2. Rename the new layer ‘actions’ by double-clicking on ‘Layer 2′ and typing ‘actions’.

3. Create a new keyframe on frame 20 of the ‘actions’ layer.

To do this:

Click on frame 20 of the ‘actions’ layer > Right click > Insert Keyframe

You will see a circle in the keyframe which shows that it is a keyframe.

4. Open the ‘Actions’ window.

To do this:

Select ‘Windows’ (from the main menu) > Select ‘Actions’

5. The ‘Actions’ window will open.

6. In the area on the right, type

stop();

7. Test the movie

You will see that the animation stops at the last frame and does not loop anymore.

Click to see the animation without looping

Series Navigation Adding new frames | Flash CS 6Change symbol size, color, rotation | Flash CS6

Tags: , , , , ,
Posted in Flash CS6 Tutorial | No Comments »