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" in Using Flash.)
To stop a movie:
stop
action.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 (mouse event)
handler, as shown here:
on (release) { stop(); }
If the action is attached to a movie clip, the action is automatically enclosed in an onClipEvent
handler, as shown here:
onClipEvent (load) { stop(); }
Note: Empty parentheses after an action indicate that it has no parameters.
To play a movie:
play
action.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 (mouse event)
handler, as shown here:
on (release) {
play();
}
If the action is attached to a movie clip, the action is automatically enclosed in an onClipEvent
handler, as shown here:
onClipEvent (load) { play(); }