User Guide

880 Chapter 14: Properties
Description
Mouse property; indicates the vertical position of the mouse cursor, in pixels, from the top of the
Stage. Read-only.
The value of this property increases as the cursor moves down and decreases as the cursor
moves up.
The
mouseV property is useful for moving sprites to the vertical position of the mouse cursor and
checking whether the cursor is within a region of the Stage. Using the
mouseH and mouseV
properties together, you can identify the cursor’s exact location.
Example
This handler moves sprite 1 to the mouse pointer location and updates the Stage when the user
clicks the mouse button:
-- Lingo syntax
on mouseDown
sprite(1).locH = _mouse.mouseH
sprite(1).locV = _mouse.mouseV
end
// JavaScript syntax
function mouseDown() {
sprite(1).locH = _mouse.mouseH;
sprite(1).locV = _mouse.mouseV;
}
This statement tests whether the pointer is more than 10 pixels above or below a starting point
and, if it is, sets the variable
vFar to TRUE:
-- Lingo syntax
startV = 7
if (abs(_mouse.mouseV - startV) > 10) then
vFar = TRUE
end if
// JavaScript syntax
var startV = 7
if (Math.abs(_mouse.mouseV - startV) > 10) {
var vFar = true;
}
See also
locH, locV, Mouse, mouseH, mouseLoc
mouseWord
Usage
-- Lingo syntax
_mouse.mouseWord
// JavaScript syntax
_mouse.mouseWord;