Actionscript 3 Can';不要停止齿轮转动
我是AS3编程的新手。我想问一下如何停止这个齿轮动画。我只是做了一个函数来停止旋转,但事件不会停止Actionscript 3 Can';不要停止齿轮转动,actionscript-3,animation,event-handling,Actionscript 3,Animation,Event Handling,我是AS3编程的新手。我想问一下如何停止这个齿轮动画。我只是做了一个函数来停止旋转,但事件不会停止 import flash.events.MouseEvent; var smallGearSpeed:Number = -2; var bigGearSpeed:Number = 1; btn_Normal.addEventListener(MouseEvent.CLICK, fl_rotateNormalHandler); btn_Acc.addEventListener(MouseEven
import flash.events.MouseEvent;
var smallGearSpeed:Number = -2;
var bigGearSpeed:Number = 1;
btn_Normal.addEventListener(MouseEvent.CLICK, fl_rotateNormalHandler);
btn_Acc.addEventListener(MouseEvent.CLICK, fl_rotateAccHandler);
btn_Stop.addEventListener(MouseEvent.CLICK, fl_rotateStopHandler);
function fl_rotateStopHandler (evt:MouseEvent):void {
addEventListener(Event.ENTER_FRAME, fl_rotateStop);
}
function fl_rotateNormalHandler (evt:MouseEvent):void {
addEventListener(Event.ENTER_FRAME, fl_rotateNormal);
}
function fl_rotateAccHandler(evt:MouseEvent):void {
addEventListener(Event.ENTER_FRAME, fl_rotateAcc);
}
function fl_rotateNormal (evt:Event):void {
rotateNormal();
}
function fl_rotateAcc (evt:Event):void {
rotateAcc();
}
function fl_rotateStop (evt:Event):void {
rotateStop();
}
function rotateNormal():void {
mc_BigGear.rotation += bigGearSpeed;
mc_SmallGear.rotation += smallGearSpeed;
trace("Normal Clicked !!!");
}
function rotateAcc():void {
mc_BigGear.rotation += bigGearSpeed;
bigGearSpeed = bigGearSpeed + .1;
mc_SmallGear.rotation += smallGearSpeed;
smallGearSpeed = smallGearSpeed - .1;
trace("Accelerate Clicked !!!");
}
function rotateStop():void {
mc_BigGear.rotation = bigGearSpeed - 1;
mc_SmallGear.rotation = smallGearSpeed + 2;
trace("Stop Clicked !!!");
}
我希望有人能帮我解决这个问题。对不起,我的英语不好,谢谢:)要“停止”活动,请删除您先前添加的侦听器,如:
removeEventListener(Event.ENTER_FRAME, fl_rotateNormal);
非常感谢你解决了我的问题,它成功了!!:)