on idle
177
on idle
Usage
-- Lingo syntax
on idle
statement(s)
end
// JavaScript syntax
function idle() {
statement(s);
}
Description
System message and event handler; contains statements that run whenever the movie has no other
events to handle and is a useful location for Lingo statements that you want to execute as
frequently as possible, such as statements that update values in global variables and displays
current movie conditions.
Because statements in
on idle
handlers run frequently, it is good practice to avoid placing Lingo
that takes a long time to process in an
on idle
handler.
It is often preferable to put
on idle
handlers in frame scripts instead of movie scripts to take
advantage of the
on idle
handler only when appropriate.
Director can load cast members from an internal or external cast during an
idle
event. However,
it cannot load linked cast members during an
idle
event.
The
idle
message is only sent to frame scripts and movie scripts.
Example
This handler updates the time being displayed in the movie whenever there are no other events to
handle:
-- Lingo syntax
on idle
member("Time").text = _system.time()
end idle
// JavaScript syntax
function idle() {
member("Time").text = _system.time();
}
See also
idleHandlerPeriod
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...