on()
Availability
Flash 2. Not all events are supported in Flash 2.
Usage
on(mouseEvent) {
// your statements here
}
Parameters
statement(s)
A
is a trigger called an "event." When the event takes place, the statements
mouseEvent
following it within curly braces execute. Any of the following values can be specified for the
parameter:
mouseEvent
•
The mouse button is pressed while the pointer is over the button.
press
•
The mouse button is released while the pointer is over the button.
release
•
releaseOutside
the button is pressed while the pointer is inside the button.
•
The pointer rolls outside of the button area.
rollOut
•
The mouse pointer rolls over the button.
rollOver
•
While the pointer is over the button, the mouse button is pressed and then rolls
dragOut
outside the button area.
•
While the pointer is over the button, the mouse button has been pressed then
dragOver
rolled outside the button and then rolled back over the button.
•
keyPress ("key")
specify a key code or key constant. For a list of key codes associated with the keys on a standard
keyboard, see
key constants, see
Description
Event handler; specifies the mouse event or keypress that triggers an action.
Example
In the following script, 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()
The instructions to execute when the
The mouse button is released while the pointer is outside the button after
The specified key is pressed. For the key portion of the parameter,
Appendix C, "Keyboard Keys and Key Code Values," on page
"Property summary for the Key class" on page
startDrag()
mouseEvent
action executes when the mouse is pressed and the
takes place.
789; for a list of
408.
on()
583
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers