Flash 2. Not all events are supported in Flash 2.
on(mouseEvent) {// your statements here}
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:
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 While the pointer is over the button, the mouse button is pressed and then rolls outside the button area just before it is released. Both the press and the dragOut events always precede a releaseOutside event.
rollOut The pointer rolls outside the button area.
rollOver The mouse pointer rolls over the button.
dragOut While the pointer is over the button, the mouse button is pressed and then rolls outside the button area.
dragOver While the pointer is over the button, the mouse button has been pressed, then rolled outside the button, and then rolled back over the button.
keyPress ("key") The specified keyboard key is pressed. For the key portion of the 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 on() handler at runtime; you must do it at authoring time. For a list of key 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 Property summary for the Key class.
Event handler; specifies the mouse event or keypress that triggers an action.
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();
}
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