Introduction to ActionScript Tutorial > Control the flow of the movie

 

Control the flow of the movie

Without ActionScript, a movie plays from Frame 1 to the last frame and either repeats from Frame 1 or stops. You can use ActionScript to control the progression of a movie more precisely; you can also use it to give the user control. For example, you could place an action in Frame 5 that stops the movie until a user presses a Play button. This is a simple example of controlling the flow of a movie.

You can use the if, else, and else if actions (also called statements) to create a more complex movie flow called logic. These three actions perform the following tasks:

The if action lets Flash check a condition in the movie and run certain actions if that condition is true.

The else statement tells Flash to run a different set of actions if the if condition is false.

The else if statement lets Flash check for another condition before running yet a different set of actions.