ADOBE DIRECTOR 11.0
User Guide
294
Checking which text is under the pointer with Lingo or
JavaScript syntax
Lingo or JavaScript syntax can detect which text component in a text or field cast member is currently under the
mouse pointer.
Use script that applies to text and field cast members in the following ways:
•
To detect which character in a text or field cast member is under the pointer, use the
pointToChar()
method.
•
To detect which item in a text or field cast member is under the pointer, use the
pointToItem()
method.
•
To detect which word in a text or field cast member is under the pointer, use the
pointToWord()
method.
•
To detect which paragraph in a text or field cast member is under the pointer, use the
pointToParagraph()
method.
Use script that applies only to text cast members: To detect whether a specific point is in a hypertext link within a
text cast member and is under the pointer, use the
pointInHyperlink()
method.
Use script that applies only to the following field cast members:
•
To detect which line in a field is under the pointer, use the
mouseLine
property.
•
To detect which word in a field is under the pointer, use the
mouseWord
property.
For more information, see the Scripting Reference topics in the Director Help Panel.
Responding to rollovers with Lingo or JavaScript
syntax
You often want some action to occur when the user rolls the mouse pointer over a sprite or a particular place on the
Stage. You can use Lingo or JavaScript syntax to specify how the movie responds to such rollovers.
Director provides several event handlers that run when the pointer rolls over a sprite. Messages for each of these
events are sent to the sprite script, the script of the cast member, the frame script, and then the movie script. For more
information, see the Scripting Reference topics in the Director Help Panel.
•
To set up script that runs when the mouse pointer enters a sprite’s bounding rectangle, place the script in an
on
mouseEnter
event handler.
•
To set up script that runs when the mouse pointer leaves a sprite’s bounding rectangle, place the script in an
on
mouseLeave
event handler.
•
To set up script that runs when the user clicks a sprite, rolls the pointer off the sprite, and then releases the mouse
button, place the script in an
on mouseUpOutside
event handler.
•
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
on mouseWithin
event handler.
The
mouseWithin
event can occur repeatedly as long as the mouse pointer remains inside the sprite.
•
To determine whether the cursor is over a specific sprite, use the
rollOver()
method.