<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="myInitialize()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function myFunction(arg:String):void {
mx.controls.Alert.show("Received call with argument=" + arg);
}
private function myInitialize():void {
myButton.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void{
var someArg:String="an_argument";
myFunction(someArg);
});
}
]]>
</mx:Script>
<mx:Button id="myButton" label="Click me!"/>
</mx:Application>
See this code in action here
No comments:
Post a Comment