ActionScript 2.0 Components Language Reference |
|
|
|
| Alert component > Using the Alert component > Creating an application with the Alert component | |||
The following procedure explains how to add an Alert component to an application while authoring. In this example, the Alert component appears when a stock hits a certain price.
To create an application with the Alert component:This adds the component to the library, but doesn't make it visible in the application.
click event:
import mx.controls.Alert;
// Define action after alert confirmation.
var myClickHandler:Function = function (evt_obj:Object) {
if (evt_obj.detail == Alert.OK) {
trace("start stock app");
}
};
// Show alert dialog box.
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 myClickHandler function. The myClickHandler function instructs Flash to trace "start stock app" when you click the OK button.
|
NOTE |
The |
|
|
|
|