flash循环添加拖动和停止

为影片剪辑添加循环监听器

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();
}

 





posted @ 2012-12-16 14:11  thero  阅读(194)  评论(0编辑  收藏  举报