The Alert control is a MX component. It has no Spark component. The Alert
control contains a message, icon, title, and buttons. Flex uses the show()
method of the Alert classfor open a dialog box.
The Syntax of Alert.show() method is:
| public static show( text:String, title:String=null, flags:uint=mx.controls.Alert.OK, parent:Sprite=null, clickListener:Function=null, iconClass:Class=null, defaultButton:uint=mx.controls.Alert.OK ):Alert |
|
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s=" library://ns.adobe.com/flex/spark"xmlns:mx=" library://ns.adobe.com/flex/mx"minWidth=" 955" minHeight="600"><fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.CloseEvent; [Embed(source="C:/work/bikrant/flex4component/alert/submit.png")] [Bindable] public var icon:Class; public function alertcontrol(obj:CloseEvent):void{ if(obj.detail==Alert.OK){ lbl.text=txt1.text; } } ]]> </fx:Script> <s:Panel title="Alert control Example" width="215" height="192"> <s:VGroup x="18" y="16" height="116"> <s:TextInput id="txt1"/> <s:Button id="btn" label="Submit" click='Alert.show("Submitted Successfully", "Alert Message", Alert.OK | Alert.CANCEL, this, alertcontrol, icon, Alert.OK);'/> <s:Label id="lbl" fontWeight="bold"/> </s:VGroup> </s:Panel> </s:Application> |
In this example you can see how we can use a Alert control in Flex4.
To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.