<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function button1_clickHandler(event:MouseEvent):void
{
if(event.target.id=="red")
{
Alert.show(event.type+"红色");
}
if(event.target.id=="green")
{
Alert.show(event.type+"绿色");
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:Button x="108" y="109" label="红色" click="button1_clickHandler(event)" id="red" />
<s:Button x="108" y="159" label="绿色" click="button1_clickHandler(event)" id="green"/>
<s:Button x="110" y="220" label="标签" click="Alert.show('直接在标签中 写入时间处理方法')" id="n"/>