Actually, I think it's a good question - I'll try to shed some light.

"me" resides at the heart of the difference between a simple sprite
script and a true behavior. If your behavior handlers end with "me",
they have two good things going for them:

1). when a behavior initiates, an "instance" or copy of your script is
created in RAM. If your behavior is attached to ten sprites, then ten
SEPARATE copies (instances) of the script are created.
That's good, because it allows all ten copies (instances) to have their
own property values and react independently of each other, even though
you've only written one script.

2). All handlers in your sprite script, which has now become a behavior,
have access to the property variables declared in the top of the
behavior. I think of them as a kind af variable which are a stage
between global and local - locals die with the handler, and globals
are...global. Property variables are shared by all handlers in the
behavior.

So - to put it short, "me" is a pointer to the adress in RAM where this
particular instance (copy) of your script resides.

Try this:

* Create a shape cast member.

* Drag it into frame 1 of the score ten times, so you have ten sprites,
1-10, with the same cast member.

* Write a behavior:

property sNum

on beginSprite me
sNum = me.spriteNum
put "the script object of sprite "&sNum && "has this adress in RAM: " &
me & RETURN
end

* Add the behaviopr to all ten sprites

* Run the movie and watch the message window.

* now remove the "me" and try again

regards, 
Clars





Mushtaq Farooqui wrote:
> 
> I'm not a programmer, (designer only!) and I'm quite hesitant in posing this
> question - it must be so basic - but I've been unable to find the answer
> anywhere.
> The question is: what is the meaning of the characters "me" as in
> "me.spriteNum", or "p" as in "pModel"? When does one use these?
> Thanks in advance!
> 
> MFarooqui
> [EMAIL PROTECTED]
> 
> [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