
Button.onRelease() Event Handler
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
467
radio buttons or weapons firing in a game, but use release events to allow the user to
change his mind before releasing the mouse.
Example
cancel_btn.onPress = function () {
// Handle event...
trace("press detected");
};
See Also
Button.onRelease(), MovieClip.onPress(); Chapter 10
Button.onRelease() Event Handler
occurs when the mouse is pressed and then released while the pointer is over a Flash button
Flash 6; on (release) supported since Flash 2
theButton.onRelease()
on (release) {
statements
}
Description
The onRelease() event handler is executed when the following sequence is detected:
1. The mouse pointer is in the hit area of
theButton.
2. The primary mouse button is pressed while the mouse pointer is still in the hit area of
theButton (at which point an onPress() event occurs).
3. The primary mouse button is released while the mouse pointer is still in the hit area of
theButton (at which point an onRelease() event occurs).
By using the release event instead of the press event, you give users a chance to move the
pointer off of a button even after the mouse has been pressed, thus allowing them to retract
their action. The onRelease() handler is the most common button handler in Flash. It is
used to respond to the classic ...