flex中动态添加button的问题
<?xmlversion="1.0"encoding="utf-8"?><mx:Applicationxmlns...
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="init(event)"> <mx:Script> <![CDATA[ import mx.events.FlexEvent; import mx.events.EventListenerRequest; import mx.controls.Button; public function init(e:FlexEvent):void{ for(var i:int=0;i++;i<12){ for(var j:int=0;j++;j<12){ var b:Button =new Button(); b.id=i.toString()+j.toString(); b.width=100; b.height=100; b.x=i*100; b.y=j*100; b.label=""; this.addChild(b); b.addEventListener(MouseEvent.CLICK,bClick); } } } private function bClick(e:MouseEvent):void{ } ]]> </mx:Script> </mx:Application> 添加不了
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询