on()

Availability

Flash 2. Not all events are supported in Flash 2.

Usage

on(mouseEvent) {
   // your statements here
}

Parameters

statement(s) The instructions to execute when the mouseEvent occurs.

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:

Description

Event handler; specifies the mouse event or keypress that triggers an action.

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()


 

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

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001627.html