User Guide
80 Alert component (Flash Professional only)
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
myClickHandler. The event handler is passed
to the
Alert.show() method as the fifth parameter. The event object is captured by
myClickHandler in the evt parameter. The detail property of the event object is then used
in a
trace statement to send the name of the button that was clicked (Alert.OK or
Alert.CANCEL) to the Output panel.
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