394
Example
This example is a simple button behavior that switches the bitmap of the button when the mouse
rolls over and then off the button:
property spriteNum
on mouseEnter me
-- Determine current cast member and switch to next in cast
currentMember = sprite(spritenum).member.number
sprite(spritenum).member = current 1
end
on mouseLeave me
-- Determine current cast member and switch to previous in cast
currentMember = sprite(spritenum).member.number
sprite(spritenum).member = currentMember - 1
end
See also
on mouseLeave
,
on mouseWithin
mouseH
Syntax
the mouseH
mouseH()
Description
System property and function; indicates the horizontal position of the mouse pointer. The value
of
mouseH
is the number of pixels the cursor is positioned from the left edge of the Stage.
The
mouseH
function is useful for moving sprites to the horizontal position of the mouse pointer
and checking whether the pointer is within a region of the Stage. Using the
mouseH
and
mouseV
functions together, you can determine the cursor’s exact location.
The Director player for Java doesn’t update the
mouseH
function when Lingo is in a repeat loop.
This function can be tested but not set.
Examples
This handler moves sprite 10 to the mouse pointer location and updates the Stage when the user
clicks the mouse button:
on mouseDown
sprite(10).locH = the mouseH
sprite(10).locV = the mouseV
updateStage
end
This statement tests whether the pointer is more than 10 pixels to the right or left of a starting
point and, if it is, sets the variable
Far
to
TRUE
:
if abs(mouseH() - startH) > 10 then
draggedEnough = TRUE
See also
locH
,
locV
,
mouseV
,
mouseLoc
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...