•
To set up script that runs when the mouse pointer is within a sprite's bounding rectangle when
the playhead enters the frame that contains the sprite, place the script in an
event handler.
The
mouseWithin
inside the sprite.
•
To determine whether the cursor is over a specific sprite, use the
Finding mouse pointer locations with Lingo or JavaScript syntax
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
Scripting Reference topics in the Director Help Panel.
The
property returns the distance, in pixels, between the mouse pointer and the upper-
mouseV
left corner of the Stage. The
pointer and the upper left corner of the Stage.
The statements
put the mouseH
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(_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
property.
A common place for using
script to check the value of
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
event can occur repeatedly as long as the mouse pointer remains
and
properties. For more information about these properties, see the
mouseV
property returns the distance, in pixels, between the mouse
mouseH
and
put the mouseV
and
key
keyCode
only when a key is actually pressed. For example, the following
key
rollOver()
display the mouse pointer's location in
key
is in an
handler, which instructs the
on keyDown
Checking keys with Lingo or JavaScript syntax
on mouseWithin
method.
property.
keyCode
297
Need help?
Do you have a question about the DIRECTOR MX 2004-USING DIRECTOR and is the answer not in the manual?
Questions and answers