In Director, to create objects you use parent scripts (or behavior scripts). The passage you quoted below refers to the fact that within a parent or behavior script, you can create a timeout object in one handler (also known as a method), and set the target (the method to be called back when the timeout occurs) to be another method within the same script. You do this by specifying the name of the target method, and passing "me" as the target object.
Here's some code from a typical parent script - let's call it MyTimer.
on new me return me end
on mStartMyTimer me
oTimeout = timeOut("Initialize").new(100, #mTimerCallBackmethod, me)
endon mTimerCallBackmethod me
timeout("initialize").forget() -- forget the timer
endLet's say that you place the above code in a parent script, then create a global object from the script like this:
global gMyTimer
gMyTimer = new(script "MyTimer")
Then, at some time, you call:
gMyTimer.mStartMyTimer()
Then, 100 ms later, the mTimerCalllBackmethod of that object will be called back.
Alternatively (but similarly), if you put this code into a behavior and attach it to a sprite say in channel 1:
on mStartMyTimer me
oTimeout = timeOut("Initialize").new(100, #mTimerCallBackmethod, me)
endon mTimerCallBackmethod me
timeout("initialize").forget()
endYou could do a
sendSprite(1, #mStartMyTimer)
then, 100 ms later, the mTimerCallbackMethod would be called back.
The key is the word "me" which refers to the current "instance" of the script. Macromedia calls this instance the "child" that is created from a parent script or a behavior created from a behavior script.
Hope this helps,
Irv
At 4:22 PM -0400 7/24/03, Denis Bel-Isle wrote:
Hi,
I often need millisecond precision and I'm very interested by this. I don't understand very well how to use the #target attribute of the timeout object. I work out fine timeout() when the #timeoutHandler is in a movie script - works great. But what does" "The targetObject identifies the name of the child object that contains the #timeoutHandler" exactly means? The child of which parent? I have tried with the #timeoutHandler in a member script, but it doesn't seem to work. I would be grateful if someone could provide a small example.
Thanks in advance,
Denis
--
Multimedia Wrangler. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/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!]
