生活在开发者的领域, 就要日新月异的发展

 

FLEX4 中的简单事件处理

 

代码
<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"/>

 

posted on 2010-12-15 13:53  施大爷  阅读(97)  评论(0)    收藏  举报

导航