Here's a practical example to bolster what Kerry said.

When you use me in a behavior, each handler that uses it
has access to the properties and globals declared for
the behavior.

Here's my generic rollover script:


property mySprite, spriteNum, orgMem, rollMem

on beginSprite me
  mySprite = sprite(spriteNum)
  orgMem = mySprite.member.name
  rollMem = orgMem & "_roll"
end

on mouseEnter me
  mySprite.member = rollMem
end

on mouseLeave me
  mySprite.member = orgMem
end


Because I used me on each of those handlers, they have
access to the behavior properties declared at the beginning
of the behavior.  If I was to delcare a global as well,
they would have access to that.  Such that:

global gSomeVariable

on myHandler me
  put gSomeVariable
end

Because I used me, I don't need to declare the global again
inside myHandler.

It also refers directly to the behavior (hence, me).

me.spriteNum is the spriteNum associated with the behavior,
the sprite that the behavior is attached to.

Check out this article for more on OOP, me, and dot syntax:
http://www.mcli.dist.maricopa.edu/director/tips/oops/035.html
and
http://www.zeusprod.com/nutshell/dotsyntax.html

HTH,
Steven Sacks



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Kerry Thompson
> Sent: Friday, October 20, 2000 12:43 AM
> To: [EMAIL PROTECTED]
> Subject: Re: <lingo-l> Behaviour Script "me"
>
>
>
> >I have a query the answer to which i hope is very simple. When we give a
> >behaviour script the mouseup handler is followd by "me" . What does this
> >stand for?
>
> Briefly, "me" is the instance of the behavior or parent script--in your
> case, probably a behavior attached to a sprite.
>
> For example, if you attach the behavior to a half-dozen sprites, each
> sprite would be a "me". You would be creating a half-dozen
> instances of the
> behavior, each with a "me" reference.
>
> Does that help?
>
> Cordially,
> Kerry Thompson
> Sr. Interface Engineer
> Learning Network
>
>
> [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!]
>
>


[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