User Guide

SimpleButton class 689
SimpleButton.click
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
Usage 1:
on(click){
...
}
Usage 2:
listenerObject = new Object();
listenerObject.click = function(eventObject){
...
}
buttonInstance.addEventListener("click", listenerObject)
Description
Event; broadcast to all registered listeners when the mouse is clicked (released) over the button or
if the button has focus and the Spacebar is pressed.
The first usage example uses an
on() handler and must be attached directly to a Button
component instance. The keyword
this, used inside an on() handler attached to a component,
refers to the component instance. For example, the following code, attached to the Button
component instance
myButtonComponent, sends “_level0.myButtonComponent” to the
Output panel:
on(click){
trace(this);
}
The behavior of this is different when used inside an on() handler attached to a regular Flash
button symbol. In that situation,
this refers to the Timeline that contains the button. For
example, the following code, attached to the button symbol instance
myButton, sends “_level0”
to the Output panel:
on(release){
trace(this);
}
Note: The built-in ActionScript Button object doesn’t have a
click event; the closest event
is
release.