On() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

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 occurs, the statements following it
mouseEvent
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
rolls outside the button area just before it is released. Both the
always precede a
The pointer rolls outside 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")
parameter, specify a key code or key constant. You can use this parameter to intercept a key
press, that is, to override any built-in behavior for the specified key. The button can be
anywhere in your application, on or off the Stage. One limitation of this technique is that you
can't apply the
codes associated with the keys on a standard keyboard, see Appendix C, "Keyboard Keys and
Key Code Values" in Using ActionScript in Flash; for a list of key constants, see
summary for the Key class" on page
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(this);
}
678
Chapter 2: ActionScript Language Reference
The instructions to execute when the
While the pointer is over the button, the mouse button is pressed and then
event.
releaseOutside
The specified keyboard key is pressed. For the
handler at runtime; you must do it at authoring time. For a list of key
on()
341.
startDrag()
ActionScript Language Reference
mouseEvent
function executes when the mouse is pressed, and the
CHAPTER 2
occurs.
and the
press
dragOut
portion of the
key
"Property
events

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents