Lingo Dictionary > O-R > on prepareMovie |  |

on prepareMovie

Syntax

    on prepareMovie
    	statement(s)
    end

Description

System message and event handler; contains statements that run after the movie preloads cast members but before the movie does the following:

| Creates instances of behaviors attached to sprites in the first frame that plays.
| Prepares the first frame that plays, including drawing the frame, playing any sounds, and executing transitions and palette effects.

New global variables used for sprite behaviors in the first frame should be initialized in the `on` `prepareMovie` handler. Global variables already set by the previous movie do not need to be reset.

An `on prepareMovie` handler is a good place to put Lingo that creates global variables, initializes variables, plays a sound while the rest of the movie is loading into memory, or checks and adjusts computer conditions such as color depth.

The `go`, `play`, and `updateStage` commands are disabled in an `on prepareMovie` handler.

Example

This handler creates a global variable when the movie starts:

    on prepareMovie
    	global currentScore
    	set currentScore = 0
    end

See also

`on enterFrame`, `on startMovie`