User Guide
190 Chapter 10: Events and Messages
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:
-- Lingo syntax
on prepareMovie
global currentScore
currentScore = 0
end
// JavaScript syntax
function prepareMovie() {
_global.currentScore = 0;
}
See also
on enterFrame, on startMovie
on resizeWindow
Usage
-- Lingo syntax
on resizeWindow
statement(s)
end
// JavaScript syntax
function resizeWindow() {
statement(s);
}
Description
System message and event handler; contains statements that run when a movie is running as a
movie in a window (MIAW) and the user resizes the window by dragging the window’s resize box
or one of its edges.
An
on resizeWindow event handler is a good place to put Lingo related to the window’s
dimensions, such as Lingo that positions sprites or crops digital video.