User Guide

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