Define an event listener for the Button control

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.controls.Alert;
private function alertListener():void {
myText.text = myInput.text;
Alert.show("Text Copied!", "Alert Box", Alert.OK);
}
</mx:Script>
<mx:TextInput id="myInput" width="150" text="" />
<mx:Button id="myButton" label="Copy Text" click="alertListener();" />
<mx:TextInput id="myText" />
</mx:Application>
Related examples in the same category