问题描述
- flash控制mc移动,为什么移动一段时间后按钮就直接无效了
- 代码贴下:
import flash.utils.Timer;
import flash.events.TimerEvent;
var timer:Timer = new Timer(40); //100毫秒一跳
var i:Number = 0;
timer.stop();
background.stop();
timer.addEventListener(TimerEvent.TIMERrun);
function run (e){
if(i == 224){
background.gotoAndPlay(1);
}else{
i++;
background.play();
}
}button_down.addEventListener(MouseEvent.MOUSE_DOWNback_play)//点击背景移动
function back_play(event:MouseEvent):void{
timer.start();
}
button_down.addEventListener(MouseEvent.MOUSE_UPback_stop) //弹起停止移动
function back_stop(event:MouseEvent):void{
background.stop();
timer.stop();
}
时间: 2025-01-20 12:55:17