N-R > on(mouseEvent)
on(mouseEvent)Syntax
on(
mouseEvent
) {
statement;
}
Arguments
statement
The instructions to execute when the mouseEvent takes place.
A mouseEvent
action can have one of the following arguments:
![]() |
press The mouse button is pressed while the pointer is over the button. |
![]() |
release The mouse button is released while the pointer is over the button. |
![]() |
releaseOutside The mouse button is released while the pointer is outside the button. |
![]() |
rollOver The mouse pointer rolls over the button. |
![]() |
rollOut The pointer rolls outside of the button area. |
![]() |
dragOver While the pointer is over the button, the mouse button has been pressed while rolled outside the button, and then rolled back over the button. |
![]() |
dragOut While the pointer is over the button, the mouse button is pressed and then rolls outside the button area. |
![]() |
keyPress ( "key" ) The specified key is pressed. The key portion of the argument is specified using any of the key codes listed in the Appendix B, "Keyboard Keys and Key Code Values," or any of the key constants listed in the Property summary for the Key object. |
Description
Handler; specifies the mouse event, or keypress that trigger an action.
Player
Flash 2 or later.
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) { if(getproperty("", _droptarget) == target) { setProperty ("rabbit", _x, _root.rabbit_x); setProperty ("rabbit", _y, _root.rabbit_y); } else { _root.rabbit_x = getProperty("rabbit", _x); _root.rabbit_y = getProperty("rabbit", _y); _root.target = "pasture"; } trace(_root.rabbit_y); trace(_root.rabbit_x); stopDrag(); }
See also
Key (object) onClipEvent