In the Actions panel, enter the following code on Frame 1 of the Timeline to define an event
3.
handler for the
import mx.controls.Alert;
myClickHandler = function (evt){
if (evt.detail == Alert.OK){
trace("start stock app");
// startStockApplication();
}
}
Alert.show("Launch Stock Application?", "Stock Price Alert", Alert.OK |
Alert.CANCEL, this, myClickHandler, "stockIcon", Alert.OK);
This code creates an Alert window with OK and Cancel buttons. When the user clicks either
button, Flash calls the
Flash calls the
Note: The
Alert.show()
window (in this example, an icon with the linkage identifier "stockIcon"). To include this icon in your
test example, create a symbol named stockIcon and set it to Export for ActionScript in the Linkage
Properties dialog box or the Create New Symbol dialog box.
Select Control > Test Movie.
4.
Customizing the Alert component (Flash Professional only)
The Alert component positions itself in the center of the component that was passed as its
parameter. The parent must be a UIComponent object. If it is a movie clip, you can register the
clip as mx.core.View so that it inherits from UIComponent.
The Alert window automatically stretches horizontally to fit the message text or any buttons that
are displayed. If you want to display large amounts of text, include line breaks in the text.
The Alert component does not respond to the
Using styles with the Alert component
You can set style properties to change the appearance of an Alert component. If the name of a
style property ends in "Color", it is a color style property and behaves differently than noncolor
style properties. For more information, see
on page
67.
An Alert component supports the following styles:
Style
themeColor
backgroundColor
116
Chapter 6: Components Dictionary
event:
click
myClickHandler
startStockApplication()
method includes an optional parameter that displays an icon in the Alert
Theme Description
Halo
The base color scheme of a component. Possible values are
"haloGreen"
is
"haloGreen"
Both
The background color. The default color is white for the Halo
theme and 0xEFEBEF (light gray) for the Sample theme.
function. But when the user clicks the OK button,
function.
method.
setSize()
"Using styles to customize component color and text"
,
, and
"haloBlue"
.
. The default value
"haloOrange"
parent
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?