User Guide
564 Chapter 2: ActionScript Language Reference
MovieClip.onPress
Availability
Flash Player 6.
Usage
my_mc.onPress = function() {
// your statements here
}
Parameters
None.
Returns
Nothing.
Description
Event handler; invoked when the user clicks the mouse while the pointer is over a movie clip. You
must define a function that executes when the event handler is invoked. You can define the
function on the Timeline or in a class file that extends the MovieClip class or is linked to a symbol
in the library. For more information, see “Assigning a class to a movie clip symbol” in Using
ActionScript in Flash.
Example
The following example defines a function for the onPress method that sends a trace() action to
the Output panel:
my_mc.onPress = function () {
trace ("onPress called");
};