Finding mouse pointer locations with Lingo or
JavaScript syntax
When working in Director, you sometimes need to determine where the mouse pointer is on the Stage.
Use the
and
mouseH
mouseV
topics in the Director Help Panel.
The
property returns the distance, in pixels, between the mouse pointer and the upper-left corner of the
mouseV
Stage. The
property returns the distance, in pixels, between the mouse pointer and the upper-left corner of
mouseH
the Stage.
The statements
put the mouseH
For example, the following 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(_mouse.mouseH)
put(_mouse.mouseV)
_movie.go(_movie.frame)
end
Checking keys with Lingo or JavaScript syntax
Lingo or JavaScript syntax can detect the last key that the user pressed. For more information, see the Scripting
Reference topics in the Director Help Panel.
•
To obtain the ANSI value of the last key that was pressed, use the
•
To obtain the keyboard's numerical (or ASCII) value for the last key pressed, use the
A common place for using
the value of
only when a key is actually pressed. For example, the following handler in a frame script sends
key
the playhead to the next marker whenever the user presses Enter (Windows) or Return (Mac):
on keyDown
if the key = RETURN then go to marker (1)
end
Equivalent cross-platform keys
Keys on Windows and Mac computers don't always directly correspond. This discrepancy can create confusion
because script often uses the same term to refer to corresponding keys on Windows and Mac computers, even
though the key's name differs on the two platforms.
The following table lists script elements that refer to specific keys and the keys they represent on each platform.
properties. For more information about these properties, see the Scripting Reference
and
put the mouseV
and
is in an
key
keyCode
display the mouse pointer's location in the Message window.
property.
key
handler, which instructs the script to check
on keyDown
ADOBE DIRECTOR 11.0
User Guide
property.
keyCode
295