Using Director > Navigation and User Interaction > Responding to rollovers with Lingo |  |

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.

| 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. See on mouseEnter.
| To set up Lingo that runs when the mouse pointer leaves a sprite's bounding rectangle, place the Lingo in an `on mouseLeave` event handler. See `on mouseLeave`.
| 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. See `on mouseUpOutside`.
| To set up Lingo that runs when the mouse pointer is within a sprite's bounding rectangle when the playback head enters the frame that contains the sprite, place the Lingo in an `on mouseWithin` event handler. See `on mouseWithin`.
| 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. See `rollOver()`.