Using Director > Navigation and User Interaction > Detecting mouse clicks with Lingo |  |

Detecting mouse clicks with Lingo

Users can click the mouse button in several ways, each of which Lingo can detect. The following are ways that you can use Lingo to detect what the user does with the mouse.

| To determine the last place the mouse was clicked, use the `clickLoc()` function. See `clickLoc`.
| To determine the last active sprite (a sprite with a script attached) that the user clicked, use the `clickOn` function. See `clickOn`.
| To determine whether the last two clicks were a double-click, use the `doubleClick` function. See `doubleClick`.
| To determine the time since the mouse was last clicked, use the `lastClick()` function. See `lastClick()`.
| To determine whether the mouse button is pressed, check the `mouseDown` property. See `the mouseDown (system property)`.
| To determine whether the mouse button is released, check the `mouseUp` property. See `the mouseUp (system property)`.
| To determine whether the user presses the right mouse button (Windows) or Control+click (Macintosh), check the `rightMouseDown` property. See `rightMouseDown (system property)`.
| To determine whether the user releases the right mouse button (Windows) or Control+click (Macintosh), check the `rightMouseUp` property. See `rightMouseUp (system property)`.

For example, this handler checks whether the user double-clicked the mouse button and, if so, runs the handler `openWindow`:

    on mouseDown
    	if the doubleClick = TRUE then openWindow
    end