Pass in user function to alert box : Alert « Components « Flex






Pass in user function to alert box

Pass in user function to alert box
   

<?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>
        
            import mx.controls.Alert;
            import mx.events.CloseEvent;

            [Bindable]
            [Embed(source='a.png')]
            private var Icon:Class;

            private function showAlert():void {
                var titleText:String = "WARNING";
                var messageText:String = "OK to continue, Cancel to abort.";
                var a:Alert = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);
            }

            private function doClose(evt:CloseEvent):void {
                trace("close");
            }
      
    </mx:Script>

    <mx:Button label="Launch Alert" click="showAlert();" />

</mx:Application>

   
    
    
  








Related examples in the same category

1.Adding icon to Alert boxAdding icon to Alert box
2.Using the Alert controlUsing the Alert control
3.Show alert with Yes no buttonShow alert with Yes no button
4.Using ActionScript and MXML together to show alert dialogUsing ActionScript and MXML together to show alert dialog
5.To use the Alert controlTo use the Alert control
6.Alert control sizes itself to fit its text, buttons, and iconAlert control sizes itself to fit its text, buttons, and icon
7.Include an icon in the Alert controlInclude an icon in the Alert control
8.Show an Alert windowShow an Alert window
9.If the result of the validate() method call is invalid then display an alertIf the result of the validate() method call is invalid then display an alert
10.Alert classAlert class
11.Cancel button Alert dialogCancel button Alert dialog
12.OK CANCEL button alert dialogOK CANCEL button alert dialog
13.Alert dialog button click handlerAlert dialog button click handler
14.Add icon to Alert dialogAdd icon to Alert dialog
15.show an alert window with clicking the buttonshow an alert window with clicking the button
16.Use creationComplete event to open an Alert box when the children of the HGroup container are fully processed and drawnUse creationComplete event to open an Alert box when the children of the HGroup container are fully processed and drawn
17.Open an alert when a the user clicks a data point (a column) in the chart:Open an alert when a the user clicks a data point (a column) in the chart:
18.Alert windowAlert window
19.Alert window with titleAlert window with title
20.A non-modal Alert windowA non-modal Alert window
21.Choose buttons for Alert dialog boxChoose buttons for Alert dialog box
22.An Alert dialog with custom button labelsAn Alert dialog with custom button labels
23.Alert dialog box With Default ButtonAlert dialog box With Default Button
24.An Alert dialog with close event handlerAn Alert dialog with close event handler
25.An Alert dialog with custom iconAn Alert dialog with custom icon
26.Alert With StylesAlert With Styles
27.Check Whick button clicked in Alert box close evevtCheck Whick button clicked in Alert box close evevt
28.Changing the default button labels on an Alert controlChanging the default button labels on an Alert control
29.import the Alert class into your application, then call the show() methodimport the Alert class into your application, then call the show() method
30.Alert EventAlert Event
31.using the Alert object returned from the show() methodusing the Alert object returned from the show() method
32.Copy the text when the user selects the OK button in the Alert controlCopy the text when the user selects the OK button in the Alert control
33.Alert dialog box with IconAlert dialog box with Icon
34.Using ActionScript to set the value of the Alert message, and binds the labels in the form to resources by using the ResourceManager's getString() method.
35.Check which button click in Alert close eventCheck which button click in Alert close event
36.Set label for yes button, no button and cancel buttonSet label for yes button, no button and cancel button
37.Present user with an option of navigating to the target location or cancelling the actionPresent user with an option of navigating to the target location or cancelling the action