Lingo Dictionary > G-K > hitTest() |  |

hitTest()

Syntax

    sprite(whichFlashSprite).hitTest(point)
    hitTest(sprite whichFlashSprite, point)

Description

Function; indicates which part of a Flash movie is directly over a specific Director Stage location. The Director Stage location is expressed as a Director point value: for example, point(100,50). The `hitTest` function returns these values:

| `#background`—The specified Stage location falls within the background of the Flash movie sprite.
| `#normal—` The specified Stage location falls within a filled object.
| `#button—` The specified Stage location falls within the active area of a button.
| `#editText—` The specified Stage location falls within a Flash editable text field.

Example

This frame script checks to see if the mouse is currently located over a button in a Flash movie sprite in channel 5 and, if it is, the script sets a text field used to display a status message:

    on exitFrame
    	if sprite(5).hitTest(the mouseLoc) = #button then
    		member("Message Line").text = "Click here to play the movie."
    		updateStage
    	else
    		member("Message Line").text = ""
    	end if
    	go the frame
    end