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
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...