User Guide

Navigation and User Interaction 379
Checking which text is under the pointer with Lingo
Lingo can detect which text component in a text or field cast member is currently under the
mouse pointer. See individual properties and functions in the Lingo Dictionary.
Use Lingo that applies to text and field cast members as follows:
To detect which character in a text or field cast member is under the pointer, use the
pointToChar() function.
To detect which item in a text or field cast member is under the pointer, use the
pointToItem() function.
To detect which word in a text or field cast member is under the pointer, use the
pointToWord() function.
To detect which paragraph in a text or field cast member is under the pointer, use the
pointToParagraph() function.
Use Lingo that applies only to text cast members as follows: To detect whether a specific point is
in a hypertext link within a text cast member and is under the pointer, use the
pointInHyperlink() function.
Use Lingo that applies only to field cast members as follows:
To detect which line in a field is under the pointer, use the mouseLine function.
To detect which word in a field is under the pointer, use the mouseWord function.
Responding to rollovers with Lingo
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 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. See individual event handlers and functions in the Lingo Dictionary.
To set up Lingo that runs when the mouse pointer enters a sprite’s bounding rectangle, place
the Lingo in an
on mouseEnter event handler.
To set up Lingo that runs when the mouse pointer leaves a sprites bounding rectangle, place
the Lingo in an
on mouseLeave event handler.
To set up Lingo that runs when the user clicks a sprite, rolls the pointer off the sprite, and then
releases the mouse button, place the Lingo in an
on mouseUpOutside event handler.
To set up Lingo 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 Lingo 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() function.