Creating function and use it as event handler
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import mx.controls.Alert; public function displayMe(input1:String):void { Alert.show(input1); } </mx:Script> <mx:TextInput id="thisTextInput" text="try this" /> <mx:Button label="Display It" click="displayMe(thisTextInput.text)" /> </mx:Application>