User Guide

172 Chapter 10: Events and Messages
on exitFrame
Usage
-- Lingo syntax
on exitFrame
statement(s)
end
// JavaScript syntax
function exitFrame() {
statement(s);
}
Description
System message and event handler; contains statements that run each time the playhead exits the
frame that the
on exitFrame handler is attached to. The on exitFrame handler is a useful place
for Lingo that resets conditions that are no longer appropriate after leaving the frame.
Place
on exitFrame handlers in behavior, frame, or movie scripts, as follows:
To assign the handler to an individual sprite, put the handler in a behavior attached to
the sprite.
To assign the handler to an individual frame, put the handler in the frame script.
To assign the handler to every frame unless explicitly instructed otherwise, put the handler in a
movie script. The
on exitFrame handler then executes every time the playhead exits the frame
unless the frame script has its own
on exitFrame handler. When the frame script has its own
on exitFrame handler, the on exitFrame handler in the frame script overrides the one in the
movie script.
This event is passed the sprite script or frame script reference
me if it is used in a behavior. The
order of frame events is
prepareFrame, enterFrame, and exitFrame.
Example
This handler turns off all puppet conditions when the playhead exits the frame:
-- Lingo syntax
on exitFrame me
repeat with i = 48 down to 1
sprite(i).scripted = FALSE
end repeat
end
// JavaScript syntax
function exitFrame() {
for (i=48; i>=1; i--);
sprite(i).scripted = false;
}
}