Using the Alert control
The following code shows a very basic method for displaying an Alert dialog in a Flex application. As this is a very simple example, it doesn’t show how to properly determine which button the user clicked to dismiss the dialog box, nor does it show other techniques such as modal versus non-modal dialog boxes. I’ll try and cover those in later entries.
The following example displays a simple Alert when the user presses the Button control. The alert has two buttons, “Yes” and “No” which the user can use to dismiss the dialog:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"> <mx:Script> <![CDATA[ import mx.controls.Alert; private var alert:Alert; private function showAlert():void { var text:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.nntHello World"; var title:String = "This is the title of the Alert window"; alert = Alert.show(text, title, Alert.YES | Alert.NO); } ]]> </mx:Script> <mx:Button label="Alert.show()" click="showAlert();" /> </mx:Application> |
11:20 AM
|
Labels:
Flex Alert Control Samples,
Flex Controls Samples
|
This entry was posted on 11:20 AM
and is filed under
Flex Alert Control Samples
,
Flex Controls Samples
.
You can follow any responses to this entry through
the RSS 2.0 feed.
You can leave a response,
or trackback from your own site.
0 comments:
Post a Comment