在AS3中,监听事件,比如:
**.addEventListener(Event.COMPLETE,hander);
function hander(event:Event):void
很多时候要向这个hander方法里传递参数。使程序更灵活。
下面有一个简单的方法:
**.addEventListener(Event.ENTER_FRAME,function(e:Event){ hander2(e,12,6); });//比如要传“12”“6”这个参数 hander2如下: function hander2(event:Event,i:int,j:int):void { if ((event.target as MovieClip).currentFrame == i) { event.target.gotoAndPlay(j); } }
最新评论