User Guide
Writing Scripts with Lingo 395
Using Lingo keywords for handler names can create confusion. Although it is possible to
explicitly replace or extend the functionality of a Lingo element by using it as a handler name, this
should be done only in certain advanced situations.
When you have multiple handlers with similar functions, it is useful to give them names that have
similar beginnings so they appear together in an alphabetical listing, such as the listing that can be
displayed by the Edit > Find > Handler command.
Understanding the order of messages in a movie
Director follows a definite order when sending messages about events that occur during the
course of a movie.
When the movie first starts, events occur in the following order:
1 prepareMovie
2 beginSprite
This event occurs when the playhead enters a sprite span.
3 prepareFrame
Immediately after the prepareFrame event, Director plays sounds, draws sprites, and
performs any transitions or palette effects. This event occurs before the
enterFrame event.
An
on prepareFrame handler is a good location for Lingo that you want to run before the
frame draws.
4 startMovie
This event occurs in the first frame that plays.
When Director plays a frame, events occur in the following order:
1 beginSprite
This event occurs only if new sprites begin in the frame.
2 stepFrame
3 prepareFrame
Immediately after the prepareFrame event, Director plays sounds, draws sprites, and performs
any transitions or palette effects. This event occurs before the
enterFrame event.
4 enterFrame
After enterFrame and before exitFrame, Director handles any time delays required by the
tempo setting, idle events, and keyboard and mouse events.
5 exitFrame
6 endSprite
This event occurs only if the playhead exits a sprite in the frame.
When a movie stops, events occur in the following order:
1 endSprite
This event occurs only if sprites currently exist in the movie.
2 stopMovie