felx三种事件方式

来源:互联网 发布:centos snmp配置文件 编辑:程序博客网 时间:2024/05/03 18:47

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
 creationComplete = "init(event)"
 >
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   
   public function init(e:Event):void
   {
    bt1.addEventListener(MouseEvent.CLICK,bt1ClickHandler);
   }
   public function bt1ClickHandler(e:MouseEvent):void
   {
    testInput.text = "ActionScript注册事件监听";
   }
   public function bt2ClickHandler(e:MouseEvent):void
   {
    testInput.text = "MXML中注册事件";
   }
  ]]>
 </mx:Script>
 <mx:Button id="bt1" label="ActionScript注册事件监听" x="91" y="81" fontSize="12" width="182" height="24"/>
 <mx:Button id="bt2" label="MXML中注册事件" x="91" y="171" fontSize="12" click="bt2ClickHandler(event)" width="182" height="24"/>
 <mx:TextInput id="testInput" editable="false" x="359" y="171" width="248" fontSize="12"/>
 <mx:Button id="bt3" label="MXML定义中创建线上事件" x="91" y="251" fontSize="12" width="182" height="24" click="testInput.text='MXML定义中创建线上事件'"/>
 
</mx:Application>

原创粉丝点击