User Guide

126 Chapter 6: Components Dictionary
Example
In the following example, a handler called myClickHandler is defined and 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;
myClickHandler = function(evt){
if(evt.detail == Alert.OK){
trace(Alert.okLabel);
}else if (evt.detail == Alert.CANCEL){
trace(Alert.cancelLabel);
}
}
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
Description
Property (constant); a property with the constant hexadecimal value 0x2. This property can be
used for the
flags or defaultButton parameter of the Alert.show() method. When used as a
value for the
flags parameter, this property indicates that a No button should be displayed in the
Alert window. When used as a value for the
defaultButton parameter, the Cancel button has
initial focus and is triggered when the user presses Enter (Windows) or Return (Macintosh). If the
user tabs to another button, that button is triggered when the user presses Enter.
Example
The following example uses Alert.NO and Alert.YES as values for the flags parameter and
displays an Alert component with a No button and a Yes button:
import mx.controls.Alert;
Alert.show("This is a generic Alert window", "Alert Test", Alert.NO |
Alert.YES, this);