James, Thanks. It does clear things up.
> It's also different in that the 'me' parameter turns out to be a > sprite reference, not a behavior instance: This in particular was the source of a bug in the code I was writing. I couldn't understand why in the debugger I was seeing a sprite number instead of a reference to an instance of the behavior. Anthony www.lifelinestudios.com ----- Original Message ----- From: "James Newton" <[EMAIL PROTECTED]> To: "Lingo-L" <[email protected]> Sent: Wednesday, March 09, 2005 11:10 AM Subject: Re: <lingo-l> sprite communication syntax? > On 9/3/05 4:45 pm, "Anthony W. Fouts, Jr." <[EMAIL PROTECTED]> > wrote: > > > I have been using the following syntax for quite some time for calling > > methods in behaviors attached to sprites: > > > > -- sendsprite(spriteNum, #callSomeMethod, someParameter) > > > > It occurred to me that I call methods in child objects stored in variables > > using dot syntax . So I tried the following to call a method in a behavior > > attached to sprite: > > > > -- sprite(spriteNum).callSomeMethod(someParameter) > > > > However it produced unexpected results. How does the second differ from the > > first? > > Hi Anthony, > > Here's the summary of a recent discussion of this issue on other lists. > Thank Macromedia's Tom Higgins where appropriate. > > These techniques are the same except when it comes to handling cases > where the method doesn't exist, in which case ... > > sprite(spriteNum).callSomeMethod(someParameter) > > ... will cause a script error. > > > It's also different in that the 'me' parameter turns out to be a > sprite reference, not a behavior instance: > > -- Behavior > > on method(me) > put me > end > > > -- Message Window > > sendSprite(1, #method) > -- <offspring "Behavior" 4 88ba810> > > sprite(1).method() > -- (sprite 1) > > call(#method, sprite 1) > -- (sprite 1) > > Does this help you clear up the unexpected results? > > James > > [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!] > [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!]
