User Guide

Alert.show() 85
You can also use Alert.NONMODAL to indicate that the Alert window is nonmodal. A
nonmodal window allows a user to interact with other windows in the application.
parent The parent window for the Alert component. The Alert window centers itself in the
parent window. Use the value
null or undefined to specify the _root timeline. The parent
window must be a subclass of the UIComponent class, either as another Flash component
that is a subclass of UIComponent, or as a custom window that is a subclass of the
UIComponent (for more information see “About inheritance” in Learning ActionScript 2.0 in
Flash. This parameter is optional.
clickHandler A handler for the click events broadcast when the buttons are clicked. In
addition to the standard click event object properties, there is an additional
detail property,
which contains the flag value of the button that was clicked (
Alert.OK, Alert.CANCEL,
Alert.YES, Alert.NO). This handler can be a function or an object. For more information,
see “Using listeners to handle events” in Using Components.
icon A string that is the linkage identifier of a symbol in the library; this symbol is used as
an icon displayed to the left of the alert text. This parameter is optional.
defaultButton Indicates which button has initial focus and is clicked when a user presses
Enter (Windows) or Return (Macintosh). If a user tabs to another button, that button is
triggered when the Enter key is pressed.
This parameter can be one of the following values:
Alert.OK, Alert.CANCEL, Alert.YES,
Alert.NO.
Returns
The Alert instance that is created.
Description
Method (class); a class (static) method that displays an Alert window with a message, an
optional title, optional buttons, and an optional icon. The title of the alert appears at the top
of the window and is left-aligned. The icon appears to the left of the message text. The
buttons are centered below the message text and the icon.
Example
The following code is a simple example of a modal Alert window with an OK button:
mx.controls.Alert.show("Hello, world!");