User Guide

298
Example
This handler updates the time being displayed in the movie whenever there are no other events to
handle:
on idle
member("Time").text = the short time
end idle
See also
idleHandlerPeriod
idleHandlerPeriod
Syntax
the idleHandlerPeriod
Description
Movie property; determines the maximum number of ticks that passes until the movie sends an
idle message. The default value is 1, which tells the movie to send idle handler messages no
more than 60 times per second.
When the playhead enters a frame, Director starts a timer, repaints the appropriate sprites on the
Stage, and issues an
enterFrame event. Then, if the amount of time set for the tempo has elapsed,
Director generates an
exitFrame event and goes to the next specified frame; if the amount of
time set for this frame hasnt elapsed, Director waits until the time runs out and periodically
generates an
idle message. The amount of time between idle events is determined by
idleHandlerPeriod.
Possible settings for
idleHandlerPeriod are:
0—As many idle events as possible
1—Up to 60 per second
2—Up to 30 per second
3—Up to 20 per second
n—Up to 60/n per second
The number of
idle events per frame also depends on the frame rate of the movie and other
activity, including whether Lingo scripts are executing. If the tempo is 60 frames per second (fps)
and the
idleHandlerPeriod value is 1, one idle event per frame occurs. If the tempo is 20 fps,
three
idle events per frame occur. Idle time results from Director doesnt have a current task to
perform and cannot generate any events.
In contrast, if the
idleHandlerPeriod property is set to 0 and the tempo is very low, thousands
of
idle events can be generated.
The default value for this property is 1, which differs from previous versions in which it defaulted to 0.
Example
The following statement causes the movie to send an idle message a maximum of once per second:
the idleHandlerPeriod = 60
See also
idleLoadDone(), idleLoadMode, idleLoadTag, idleReadChunkSize