Paul Steven <[EMAIL PROTECTED]>
> If I use the following lingo
> sprite(me.spriteNum).member="Instrument2_Note"
> I get a script error
>
> Property not found
> #spriteNum
> However if I use
> sprite(the currentSpriteNum).member="Instrument2_Note"
>...it works
Hi Paul,
My guess is that you are using Cast Member Scripts and not Behaviors.
Cast Member Scripts do not receive a "me" parameter, so if you use...
on mouseUp me
... "me" will receive the value <Void>, which does not have a
"spriteNum" property.
"the currentSpriteNum" is a movie property. This means that, all
scripts everywhere will find the number of the sprite. You can open
the Watcher window and type "the currentSpriteNum" (without the quotes)
and you will be able to watch the value change as you click on different
sprites which have mouse event handlers.
Try:
-- Member script or Behavior
on mouseUp
showSpriteAlert
end
-- Movie script
on showSpriteAlert
alert "Sprite "&the currentSpriteNum&" was clicked"
end
The showSpriteAlert handler knows which sprite handled the mouseUp event
without having to be told, since it has access to the movie property
"the currentSpriteNum".
"me.spriteNum" is a behavior property. This value does not change
during the lifetime of a sprite (unless you do this on purpose), and it
does not depend on which sprite was last clicked. However, it is not
directly accessible from outside the behavior instance. You can watch
the value of "sprite(1).spriteNum" in the Watcher window, but it won't
change. "me.spriteNum" in the Watcher window will appear as <Void>,
since "me" is not an object and has no "spriteNum" property.
"the currentSpriteNum" was important until Director 6 introduced
behaviors with the "me" parameter. If you are not using behaviors, then
it is still useful.
Cheers,
James
[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!]