Set label for yes button, no button and cancel button : Alert « Components « Flex






Set label for yes button, no button and cancel button

Set label for yes button, no button and cancel button
        

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
        
            import mx.events.CloseEvent;
            import mx.controls.Alert;

            [Embed(source="a.png")]
            private var iconclass:Class

            private function createAlert():void
            {
                mx.controls.Alert.yesLabel = "Click Yes?"
                mx.controls.Alert.noLabel = "Click No?"
                mx.controls.Alert.cancelLabel = "Click Cancel?"
                mx.controls.Alert.show("This is an alert", "title of the alert", 1|2|8, this, alertClosed, iconclass);
            }

            private function alertClosed(event:CloseEvent):void
            {
                trace(" alert closed ");
                if(event.detail == Alert.YES)
                {
                    trace(" user clicked yes ");
                }
                else if(event.detail == Alert.CANCEL)
                {
                    trace(" user clicked cancle ");
                }
                else
                {
                    trace(" user clicked no ");
                }
            }

      
    </mx:Script>
    <mx:Button label="Create Simple Alert" click="createAlert()"/>
</mx:Canvas>
</mx:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Pass in user function to alert boxPass in user function to alert box
2.Adding icon to Alert boxAdding icon to Alert box
3.Using the Alert controlUsing the Alert control
4.Show alert with Yes no buttonShow alert with Yes no button
5.Using ActionScript and MXML together to show alert dialogUsing ActionScript and MXML together to show alert dialog
6.To use the Alert controlTo use the Alert control
7.Alert control sizes itself to fit its text, buttons, and iconAlert control sizes itself to fit its text, buttons, and icon
8.Include an icon in the Alert controlInclude an icon in the Alert control
9.Show an Alert windowShow an Alert window
10.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
11.Alert classAlert class
12.Cancel button Alert dialogCancel button Alert dialog
13.OK CANCEL button alert dialogOK CANCEL button alert dialog
14.Alert dialog button click handlerAlert dialog button click handler
15.Add icon to Alert dialogAdd icon to Alert dialog
16.show an alert window with clicking the buttonshow an alert window with clicking the button
17.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
18.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:
19.Alert windowAlert window
20.Alert window with titleAlert window with title
21.A non-modal Alert windowA non-modal Alert window
22.Choose buttons for Alert dialog boxChoose buttons for Alert dialog box
23.An Alert dialog with custom button labelsAn Alert dialog with custom button labels
24.Alert dialog box With Default ButtonAlert dialog box With Default Button
25.An Alert dialog with close event handlerAn Alert dialog with close event handler
26.An Alert dialog with custom iconAn Alert dialog with custom icon
27.Alert With StylesAlert With Styles
28.Check Whick button clicked in Alert box close evevtCheck Whick button clicked in Alert box close evevt
29.Changing the default button labels on an Alert controlChanging the default button labels on an Alert control
30.import the Alert class into your application, then call the show() methodimport the Alert class into your application, then call the show() method
31.Alert EventAlert Event
32.using the Alert object returned from the show() methodusing the Alert object returned from the show() method
33.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
34.Alert dialog box with IconAlert dialog box with Icon
35.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.
36.Check which button click in Alert close eventCheck which button click in Alert close event
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