The Flex framework has built-in support for pop-up windows and alerts. Pop ups can be useful for many reasons, including notifying the user of messages or news and displaying simple forms such as login forms or mailing-list sign-up forms. Unlike HTML pop ups, Flex pop ups do not open new browser windows. Flex application pop ups appear within the same Flash Player instance. This means that Flex application pop ups are never subject to the same restrictions as some types of HTML pop ups.
alert( ) function. They display text messages to the user in a modal window, and prompt the user to click a button. However, as we'll see in the next section, Flex alerts are more sophisticated than HTML alerts. Custom pop ups allow you to create more complex pop-up content. For example, using a custom pop-up you can display a mailing list email form.
Flex alerts are instances of the
mx.controls.Alert component. Unlike many of the other Flex components, you cannot create an alert using MXML tags. You must use the static
show( ) method of the
Alert class. The
show( ) method requires at least one parameter: a string specifying the message to display. The
show( ) method returns a reference to the new
Alert instance that you can use to manipulate the
Alert instance if needed. Example 8-2 ...