如何在不进入下一个场景的情况下,从同一场景中每帧暂停20秒暂停帧?这些帧中的其他场景有按钮。下面的效果很好,直到我在场景一的最后一帧,然后它进入下一个场景并播放。如何让场景1不断循环。
stop();
var timer:Timer = new Timer(20000,0);//<--
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
function timerHandler(event:TimerEvent):void {
this.nextFrame();
//or if you want to jump e.g 5 frames
this.gotoAndStop(this.currentFrame+5);
}
感谢您的帮助。
答案 0 :(得分:1)
您只需检查并查看下一帧是否将成为最后一帧:
function timerHandler(event:TimerEvent):void {
if(this.currentFrame + 1 <= this.totalFrame){ //if your desired destination is less than the total frames, then your safe to goto to the nextFrame - replace the +1 with however many frames you want to skip
this.nextFrame();
}else{ //if not, reset back to frame one (loop)
this.gotoAndStop(1);
}
}