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.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...