Chapter 15
380
Finding mouse pointer locations with Lingo
Determining where the mouse pointer is on the Stage is a common need in Director.
To determine the mouse pointer’s horizontal and vertical positions:
•
Use the
mouseH()
and
mouseV()
functions. See
mouseH
and
mouseV
in the Lingo Dictionary.
The
mouseV()
function returns the distance, in pixels, between the mouse pointer and the upper
left corner of the Stage. The
mouseH()
function returns the distance, in pixels, between the mouse
pointer and the upper left corner of the Stage.
The statements
put the mouseH
and
put the mouseV
display the mouse pointer’s location in
the Message window.
For example, this handler directs the Message window to display the distance (in pixels) between
the pointer and the upper left corner of the Stage:
on exitFrame
put the mouseH
put the mouseV
go to the frame
end
Checking keys with Lingo
Lingo can detect the last key that the user pressed. See individual properties and functions in the
Lingo Dictionary.
•
To obtain the ANSI value of the last key that was pressed, use the
key()
function.
•
To obtain the keyboard’s numerical (or ASCII) value for the last key pressed, use the
keyCode()
function.
A common place for using
key
and
keyCode
is in an
on keyDown
handler, which instructs
Lingo to check the value of
key
only when a key is actually pressed. For example, the following
handler in a frame script sends the playhead to the next marker whenever the user presses Enter
(Windows) or Return (Macintosh):
on keyDown
if the key = RETURN then go to marker (1)
end
Equivalent cross-platform keys
Because of inherent differences between Windows and Macintosh keyboards, keys on Windows
and Macintosh computers don’t always correspond directly.
This discrepancy can create confusion because Lingo often uses the same term to refer to
corresponding keys on Windows and Macintosh computers, even though the key’s name differs
on the two platforms.
The following table lists Lingo elements that refer to specific keys and the keys they represent on
each platform.
Lingo term
Windows key
Macintosh key
RETURN
Enter Return
commandDown
Control
Command
Summary of Contents for DIRECTOR MX-USING DIRECTOR MX
Page 1: ...Using Director MX Macromedia Director MX...
Page 12: ...Contents 12...
Page 156: ...Chapter 4 156...
Page 202: ...Chapter 6 202...
Page 244: ...Chapter 7 244...
Page 292: ...Chapter 10 292...
Page 330: ...Chapter 12 330...
Page 356: ...Chapter 13 356...
Page 372: ...Chapter 14 372...
Page 442: ...Chapter 16 442...
Page 472: ...Chapter 18 472...
Page 520: ...Chapter 19 520...
Page 536: ...Chapter 20 536...
Page 562: ...Chapter 23 562...
Page 566: ...Chapter 24 566...
Page 602: ...Chapter 27 602...