Creating Interaction with ActionScript > Controlling movie playback > Playing and stopping movies |
![]() ![]() ![]() |
Playing and stopping movies
Unless instructed otherwise, once a movie starts, it plays through every frame in the Timeline. You can stop or start a movie by using the play
and stop
actions. For example, you can use the stop
action to stop a movie at the end of a scene before proceeding to the next scene. Once stopped, a movie must be explicitly started again, by means of the play
action.
You can use the play
and stop
actions to control the main Timeline or the Timeline of any movie clip or loaded movie. The movie clip you want to control must have an instance name and must be present in the Timeline.(For more information, see Working with Movie Clips and Buttons.)
To stop a movie:
1 |
Select a frame, button instance, or movie clip instance to which you will assign the action. |
2 |
Choose Window > Actions to display the Actions panel if it's not already visible. If the Actions panel is not in normal mode, choose Normal Mode from the View Options pop-up menu. |
3 |
In the Actions toolbox, click the Actions category, then click the Movie Control category, and select the |
If the action is attached to a frame, the following code appears in the Script pane: |
|
stop(); |
|
If the action is attached to a button, the action is automatically enclosed in an |
|
on (release) { stop(); } |
|
If the action is attached to a movie clip, the action is automatically enclosed in an |
|
onClipEvent (load) { stop(); } |
Note: Empty parentheses after an action indicate that it has no parameters.
To play a movie:
1 |
Select the frame, button, or movie clip to which you will assign the action. |
2 |
Choose Window > Actions to display the Actions panel if it's not already visible. If the Actions panel is not in normal mode, choose Normal Mode from the View Options pop-up menu. |
3 |
In the Actions toolbox, click the Actions category, select the Movie Control category, and double-click the |
If the action is attached to a frame, the following code appears in the Script pane: |
|
play(); |
|
If the action is attached to a button, the action is automatically enclosed in an |
|
on (release) {
|
|
If the action is attached to a movie clip, the action is automatically enclosed in an |
|
onClipEvent (load) { play(); } |
![]() ![]() ![]() |