Lingo Dictionary > D-F > on exitFrame

 

on exitFrame

Syntax

on exitFrame
	statement(s)
end

Description

System message and event handler; contains statements that run each time the playback head 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 playback head 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 playback head exits the frame:

on exitFrame me
	repeat with i = 48 down to 1
		sprite(i).puppet = FALSE
	end repeat
end

Example

This handler branches the playback head to a specified frame if the value in the global variable vTotal exceeds 1000 when the playback head exits the frame:

global vTotal

on exitFrame
	if vTotal > 1000 then go to frame "Finished"
end

See also

on enterFrame