Copy the text when the user selects the OK button in the Alert control : Alert « Components « Flex






Copy the text when the user selects the OK button in the Alert control

Copy the text when the user selects the OK button in the Alert control
        

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



<!-- controls\alert\AlertEvent.mxml -->
<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">
    <fx:Script>
         
        import mx.controls.Alert; 
        import mx.events.CloseEvent; 
        private function alertListener(eventObj:CloseEvent):void { 
            // Check to see if the OK button was pressed. 
            if (eventObj.detail==Alert.OK) { 
                myText.text = myInput.text; 
            } 
        } 
      
    </fx:Script>
    <s:VGroup>
        <s:TextInput id="myInput" width="150" text="" />
        <s:Button id="myButton" label="Copy Text"
            click='Alert.show("Copy Text?", "Alert", Alert.OK | Alert.CANCEL, this,alertListener, null, Alert.OK);' />
        <s:TextInput id="myText" />
    </s:VGroup>
</s: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.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