Sprite coordinates are relative to the upper left corner of the Stage.
To make the value last beyond the current sprite, make the sprite a scripted sprite.
Example
This statement puts sprite 15 at the same vertical location as the mouse click:
-- Lingo syntax
sprite(15).locV = _mouse.mouseV
// JavaScript syntax
sprite(15).locV = _mouse.mouseV;
See also
bottom, height, left, locH, point(), right, Sprite, top,
locZ
Usage
-- Lingo syntax
spriteObjRef.locZ
// JavaScript syntax
spriteObjRef.locZ;
Description
Sprite property; specifies the dynamic Z-order of a sprite, to control layering without having to
manipulate sprite channels and properties. Read/write.
This property can have an integer value from negative 2 billion to positive 2 billion. Larger
numbers cause the sprite to appear in front of sprites with smaller numbers. If two sprites have the
same
value, the channel number then takes precedence for deciding the final display order
locZ
of those two sprites. This means sprites in lower numbered channels appear behind sprites in
higher numbered channels even when the
By default, each sprite has a
Layer-dependent operations such as hit detection and mouse events obey sprites'
changing a sprite's
sprites and the user may be unable to click on the sprite.
Other Director functions do not follow the
with channel 1 and increase consecutively from there, regardless of the sprite's Z-order.
Example
This handler uses a global variable called gHighestSprite which has been initialized in the
startMovie handler to the number of sprites used. When the sprite is clicked, its locZ is set to
gHighestSprite + 1, which moves the sprite to the foreground on the stage. Then gHighestSprite
is incremented by 1 to prepare for the next mouseUp call.
-- Lingo syntax
on mouseUp me
global gHighestSprite
sprite(me.spriteNum).locZ = gHighestSprite + 1
gHighestSprite = gHighestSprite + 1
end
838
Chapter 14: Properties
value equal to its own channel number.
locZ
value can make the sprite partially or completely obscured by other
locZ
values are equal.
locZ
ordering of sprites. Generated events still begin
locZ
updateStage()
values, so
locZ
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers