Lingo Dictionary > G-K > on idle |  |

on idle

Syntax

    on idle
    	statement(s)
    end

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:

    on idle
    	member("Time").text = the short time
    end idle

See also

`idleHandlerPeriod`