620
spriteNum
Syntax
spriteNum
the spriteNum of me
Description
Sprite property; determines the channel number the behavior’s sprite is in and makes it available
to any behaviors. Simply declare the property at the top of the behavior, along with any other
properties the behavior may use.
If you use an
on new
handler to create an instance of the behavior, the script’s
on new
handler must
explicitly set the
spriteNum
property to the sprite’s number. This provides a way to identify the
sprite the script is attached to. The sprite’s number must be passed to the
on new
handler as an
argument when the
on new
handler is called.
Examples
In this handler, the
spriteNum
property is automatically set for script instances that are created by
the system:
property spriteNum
on mouseDown me
sprite(spriteNum).member = member("DownPict")
end
This handler uses the automatic value inserted into the
spriteNum
property to assign the sprite
reference to a new property variable
pMySpriteRef
, as a convenience:
property spriteNum, pMySpriteRef
on beginSprite me
pMySpriteRef = sprite(me.spriteNum)
end
This approach allows the use of the reference
pMySpriteRef
later in the script, with the handler
using the syntax
currMember = pMySpriteRef.member
instead of the following syntax which is somewhat longer:
currMember = sprite(spriteNum).member
This alternative approach is merely for convenience, and provides no different functionality.
See also
on beginSprite
,
on endSprite
,
currentSpriteNum
spriteSpaceToWorldSpace
Syntax
sprite(
whichSprite
).camera.spriteSpaceToWorldSpace(
loc
)
sprite(whichSprite).camera(index).spriteSpaceToWorldSpace(loc)
Description
3D command; returns a world-space position that is found on the specified camera’s projection
plane that corresponds to a location within the referenced sprite. The location specified by
loc
should be a point relative to the sprite’s upper-left corner.
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...