Using Director > Parent Scripts > Creating timeout objects > Relaying system events with timeout objects

 

Relaying system events with timeout objects

When you create timeout objects that target specific child objects, you enable those child objects to receive system events. Timeout objects relay these events to their target child objects. The system events that can be received by child objects include prepareMovie, startMovie, stopMovie, prepareFrame, and exitFrame. By including handlers for these events in child objects, you can make the child objects respond to them for whatever purposes you see fit. System events received by child objects are also received by movie scripts, frame scripts, and other scripts designed to respond to them.

This parent script contains a handler for the system event exitFrame as well as a custom handler:

property velocity

on new me
	velocity = random(55)
end

on exitFrame
	velocity = velocity + 5
end

on slowDown mph
	velocity = velocity - mph
end

For information on specific timeout properties, see timeout() in the Lingo Dictionary.