为影片剪辑添加循环监听器
1 2 3 4 5 6 7 8 9 10 11 12 13 | //为蓝色方向添加监听 for ( var i: int = 0 ; i< 8 ; i++) { MovieClip( this [ "a" + i]).addEventListener( "mouseDown" ,godrag); MovieClip( this [ "a" + i]).addEventListener( "mouseUp" ,stopdrag); } //开始拖动 function godrag(me:MouseEvent) { me.target.startDrag(); } //停止拖动 function stopdrag(me:MouseEvent) { me.target.stopDrag(); |