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 takes place.

A mouseEvent is a trigger called an "event." When the event takes place, 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() action 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("rabbit");
}
on(release) {
  trace(_root.rabbit._y);
  trace(_root.rabbit._x);
  stopDrag();
}

See also

onClipEvent()