This statement creates a timeout object named
in the child object
car1
myTimer = timeOut("timer1").new(2000, #accelerate, car1)
To determine when the next timeout message will be sent from a particular timeout object, check
its
property. The value returned is the point in time, in milliseconds, when the next
#time
timeout message will be sent.
This statement determines the time when the next timeout message will be sent from the timeout
object
and displays it in the Message window:
timer1
put timeout("timer1").time
Using timeOutList
When you begin creating timeout objects, you can use
timeout objects that are active at a particular moment.
The following statement sets the variable
in the Lingo Dictionary.
count()
x = (the timeOutList).count
You can also refer to an individual timeout object by its number in the list.
The following statement deletes the second timeout object in
Lingo Dictionary.
timeOut(2).forget
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
,
stopMovie
prepareFrame
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
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
every 2 seconds:
to the number of objects in
x
, and
. By including handlers for these events in child
exitFrame
that will call the
timer1
to check the number of
timeOutList
timeOutList
prepareMovie
as well as a custom handler:
exitFrame
in the Lingo Dictionary.
timeout()
Writing Scripts with Lingo 425
handler
on accelerate
. See
timeOutList
. See
in the
forget()
,
,
startMovie
Need help?
Do you have a question about the DIRECTOR MX-USING DIRECTOR MX and is the answer not in the manual?
Questions and answers