User Guide

Alert component (Flash Professional only) 119
4.
If the advanced view is not displayed, click the Advanced button.
5.
Select Export for ActionScript.
6.
The identifier will be automatically filled out with TitleBackground.
7.
Set the AS 2.0 class to mx.skins.SkinElement.
SkinElement is a simple class that can be used for all skin elements that dont provide their own
ActionScript impelmentation. It provides movement and sizing functionality required by the
version 2 component framework.
8.
Ensure that Export in First Frame is already selected.
9.
Click OK.
10.
Open the new symbol for editing.
11.
Use the drawing tools to create a box with a red fill and black line.
12.
Set the border style to hairline.
13.
Set the box, including the border, so that is positioned at (0,0) and has a width of 100 and
height of 22.
The Alert component will set the proper width of the skin as needed, but it will use the
existing height as the height of the title.
14.
Click the Back button to return to the main Timeline.
15.
Drag an Alert component to the Stage and delete it.
This will add the Alert component to the library and available at run-time.
16.
Add ActionScript code to the main Timeline to create a sample Alert instance.
import mx.controls.Alert;
Alert.show("This is a skinned Alert component","Title");
17.
Select Control > Test Movie.
Alert class (Flash Professional only)
Inheritance MovieClip > UIObject class > UIComponent class > View > ScrollView > Window
component > Alert
ActionScript Class Name mx.controls.Alert
To use the Alert component, you drag an Alert component to the Stage and delete it so that the
component is in the document library but not visible in the application. Then you call
Alert.show() to display an Alert window. You can pass parameters to Alert.show() that add a
message, a title bar, and buttons to the Alert window.
Because ActionScript is asynchronous, the Alert component is not blocking, which means that
the lines of ActionScript code that follow the call to
Alert.show() run immediately. You must
add listeners to handle the
click events that are broadcast when a user clicks a button and then
continue your code after the event is broadcast.
Note: In operating environments that are blocking (for example, Microsoft Windows), a call to
Alert.show() does not return until the user has taken an action, such as clicking a button.