Example
With an Alert component already in the library, add this ActionScript to the first frame of the
main timeline to create an event handler called
to the
Alert.show()
in the
myClickHandler
in a
statement to send the name of the button that was clicked (
trace
) to the Output panel.
Alert.CANCEL
import mx.controls.Alert;
// Define button actions.
var myClickHandler:Function = function (evt_obj:Object) {
switch (evt_obj.detail) {
case Alert.OK :
trace("You clicked: " + Alert.okLabel);
break;
case Alert.CANCEL :
trace("You clicked: " + Alert.cancelLabel);
break;
}
};
// Display dialog box.
Alert.show("This is a test of errors", "Error", Alert.OK | Alert.CANCEL,
this, myClickHandler);
Alert.NO
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
Alert.NO
80
Alert component (Flash Professional only)
method as the fifth parameter. The event object is captured by
parameter. The
evt
. The event handler is passed
myClickHandler
property of the event object is then used
detail
or
Alert.OK
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers