How to Add Stop Code with the Action Panel in Adobe Flash CS6
You’ll find that coding using the Actions panel’s Code Editor window in Adobe Flash CS6 provides you with significant flexibility for certain tasks like adding a stop action in your Flash video.
The stop() statement does exactly what it sounds like: It stops the timeline at whatever frames it’s placed on. A common use of stop() is to keep a movie from looping, which is the default behavior for Flash Player.
Follow these steps to create a stop action in your movie:
On a new layer, create a motion or shape tween from frames 1 through 24 and press Enter or Return to play back and preview the animation.
Click the New Layer button below the timeline to create a new layer and name it Actions. If necessary, drag the layer upward so that it’s the topmost layer in the stack.
This dedicated layer is where you add ActionScript to control your new motion tween.
Add a keyframe on frame 24 of the new Actions layer with the F6 shortcut key.
Select the keyframe and choose Window→Actions to launch the Actions panel.
In the Actions panel, locate the Script Assist button and click it.
The top panel expands, and you’re now working in Script Assist mode.
You can add ActionScript to keyframes with existing content, but it’s always a good practice to separate scripts from visual elements on the stage by creating a dedicated layer for your ActionScript.
Click the plus sign at the top of the Actions panel and choose flash.display→MovieClip→Methods→Stop.
Specify in the Object text box the name of the object you want to control. Because you’re stopping the current (main) Timeline, enter the word this in place of the not_set_yet text in the Object text box.
The actions panel reads
import flash.display.MovieClip; this.stop();
Take a look at your Timeline, and you’ll notice that a lowercase a now appears inside the keyframe, which indicates that there is ActionScript on the keyframe. These scripts run when the playhead passes that keyframe.
Choose Control→Test Movie to preview your movie.
The animation plays until frame 24 and then stops.