From: James Newton
> Sent: Monday, February 23, 2004 4:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: <lingo-l> timeOut
> 
> On 23/2/04 1:26 pm, "Peter Bochan" <[EMAIL PROTECTED]> wrote:
> > Now, what I want to do is create a timeOut object. After instantiating
> myObj
> > I do this:
> > myTimer = timeOut("timer1").new(2000, #showInfo, myObj)
> > But instead I get a script error "Object expected".
> 
> Hi Peter,
> 
> Are you working with DMX 2004?  If so, you should test with the new syntax
> for timeOut objects:
> 
>   myTimer = timeOut().new("timer1", 2000, #showInfo, myObj)
> 
> In previous versions of Director, object-related functions such as
> member(),
> script(), timeOut(), window() and xtra() all looked the same, but did not
> actually behave in the same way.  TimeOut() and window() created a new
> object, whereas member(), script() and xtra() all required the target
> object
> to be present.
> 
> This has been standardised in DMX 2004, with the result that the timeOut()
> syntax, in particular, has changed.
> 
> The old syntax is still supported, so pre-DMX-2004 projects will still
> continue to work.  If you want to be able to use the old syntax in new
> projects, try this:
> 
>   the scriptexecutionstyle = 9
>   myTimer = timeOut("timer1").new(2000, #showInfo, myObj)
> 
> Cheers,
> 
> James

Thanks James, that helped a lot. Now, after I have read your message, I
wanted to try the new syntax out, so this is what I did:

-- Frame behavior

on exitFrame(me)
  go(the frame)
end

-- Parent script "car"

property name
property velocity

on new(me, tName, tVelocity)
  name = tName
  velocity = tVelocity
  return(me)
end

on showInfo(me)
  put ("My name is") && name
  put ("My velocity is") && velocity
end

on stepFrame(me)
  showInfoInMessageWindow()
end

on showInfoInMessageWindow(me, tObject)
  timeOut().new("timer1", 2000, #showInfo, tObject)
end

Run the movie

-- Message Window
myObject = script("car").new("bmw", 200)
myObject. showInfoInMessageWindow(myObject)

this results in 2 second delay flushing in Message Window.


Thanks again James.
peb965



[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!]

Reply via email to