on handler

on(mouseEvent:Object) {
// your statements here
}

Specifies the mouse event or keypress that triggers an action.

Availability: ActionScript 1.0; Flash Player 2 - Flash 2. Not all events are supported in Flash 2.

Parameters

mouseEvent:Object - A mouseEvent is a trigger called an event . When the event occurs, the statements following it within curly braces ({ }) execute. Any of the following values can be specified for the mouseEvent parameter:

For a list of key constants, see the Key class.

Example

In the following script, the startDrag() function executes when the mouse is pressed, and the conditional script is executed when the mouse is released and the object is dropped:

on (press) {
 startDrag(this);
}
on (release) {
 trace("X:"+this._x);
 trace("Y:"+this._y);
 stopDrag();
}

See also

onClipEvent handler, Key


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001202.html