Lingo Dictionary > S > on stepFrame

 

on stepFrame

Syntax

on stepFrame
	statement(s)
end

Description

System message and event handler; works in script instances in actorList because these are the only objects that receive on stepFrame messages. This event handler is executed when the playback head enters a frame or the Stage is updated.

An on stepFrame handler is a useful location for Lingo that you want to run frequently for a specific set of objects. Assign the objects to actorList when you want Lingo in the on stepFrame handler to run; remove the objects from actorList to prevent Lingo from running. While the objects are in actorList, the objects' on stepFrame handlers run each time the playback head enters a frame or the updateStage command is issued.

The stepFrame message is sent before the prepareFrame message.

Assign objects to actorList so they respond to stepFrame messages. Objects must have an on stepFrame handler to use this built-in functionality with actorList.

The go, play, and updateStage commands are disabled in an on stepFrame handler.

Example

If the child object is assigned to actorList, the on stepFrame handler in this parent script updates the position of the sprite that is stored in the mySprite property each time the playback head enters a frame:

property mySprite

on new me, theSprite
	mySprite = theSprite
	return me
end

on stepFrame me
	sprite(mySprite).loc = point(random(640),random(480))
end