标签:flex button addeventlistner
import mx.controls.Button; import mx.events.FlexEvent; protected function testClick(event:FlexEvent):void { <span style="white-space:pre"> </span>var button:Button = new Button(); button.id="myButton"; //这里还可以添加各种你需要标志的属性 button.addEventListener(MouseEvent.CLICK,myButtonClick); this.addElement(button); } private function myButtonClick(event:MouseEvent):void{ var button:Button = event.currentTarget as Button; var id:String = button.id;
<span style="white-space:pre"> </span>//var 其余属性;
}
代码如上,和安卓也比较类似。
【Flex】在addEventListener下获取Button对象
标签:flex button addeventlistner
原文地址:http://blog.csdn.net/liming199364/article/details/45127333