<?xml version="1.0" encoding="utf-8"?>
<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" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function onClick(event:Event):void{
Alert.show(event.target.label+"clicked","Event Test");
}
]]>
</fx:Script>
<s:Button label="Button 1" click="onClick(event)"/> </s:Application>
a.mxml
内联MXML
<?xml version="1.0" encoding="utf-8"?>
<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" minWidth="955" minHeight="600">
<s:Button label="按钮1"> <s:click>
<![CDATA[
import mx.controls.Alert;
Alert.show(event.target.label + "clicked","Event Test");
]]>
</s:click>
</s:Button>
</s:Application>