A function returning String and use it in button 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 textMerge(input1:String,input2:String):String
{
var x:String = input1 + input2;
return x;
}
</mx:Script>
<mx:TextInput id="value1" />
<mx:Label text="and" />
<mx:TextInput id="value2" />
<mx:Button label="Join" click="Alert.show(textMerge(value1.text,value2.text))" />
</mx:Application>
Related examples in the same category