At 15:28 +0530 01_04_26, [EMAIL PROTECTED] wrote:

>This can also be used with behaviors if you want them to last beyond the
>last frame of the sprites they are attached to. Simply add the behavior to
>the actorList and then you can refer to it even from other frames or even
>movies. See this trick in action in the Multiuser connection behavior that
>ships in the library.

Yeah but these days I would forego the actorList and rather create a 
timeoutobject calling back to the object that needs regular 
frame-events, like so:

--timeOut(Name).new(period, timeOutHandler <,targetObject>)
timeOut(me && "eventRelay").new(0, #dummy, me)

This would never actually send back any timed messages, but would 
relay all the cyclic frame-events to the object.
So you could use prepare/enter/exit-frame as you desire.

One great advantage to this method is that a an object can easily 
terminate its cyclic messaging setup without disturbing other 
objects: You may be aware that when an object removes itself from the 
actorlist from within its stepFrame handler, then the next object in 
the actorList misses an event.
Probably with this in mind the timeOutObjectList is designed so that 
it is traversed backwards allowing one timeOutObject to be forgotten 
without affecting other timeOutObjects.

So to terminate callbacks, relying on the fact that timeOutObjects 
provide themselves as the second parameter when calling back:

on exitFrame me, aTimer
   if enough then aTimer.forget()
   ...

I use this a lot for oneshot asynchronously deferred events.

Jakob

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to