User Guide
65
3
CHAPTER 3
Alert component (Flash
Professional only)
The Alert component lets you display a window that presents the user with a message and
response buttons. The window has a title bar that you can fill with text, a message that you
can customize, and buttons whose labels you can change. An Alert window can have any
combination of Yes, No, OK, and Cancel buttons, and you can change the button labels by
using the
Alert.okLabel, Alert.yesLabel, Alert.noLabel, and Alert.cancelLabel
properties. You cannot change the order of the buttons in an Alert window; the button order
is always OK, Yes, No, Cancel. An Alert window closes when a user clicks any of its buttons.
To display an Alert window, call the
Alert.show() method. In order to call the method
successfully, the Alert component must be in the library. By dragging the Alert component
from the Components panel to the Stage and then deleting the component, you add the
component to the library without making it visible in the document.
The live preview for the Alert component is an empty window.
When you add an Alert component to an application, you can use the Accessibility panel to
make the component’s text and buttons accessible to screen readers. First, add the following
line of code to enable accessibility:
mx.accessibility.AlertAccImpl.enableAccessibility();
NOTE
You enable accessibility for a component only once, regardless of how many instances
you have of the component.