Actionscript 3 AS3/在向量处停止计时器?
如何在向量[2]处启动计时器并在向量[13]处停止计时器<代码>myTimer.stop()代码> 我已经做了,向量每10秒跳到下一个向量(timerevent)。计时器和向量将继续计数,然后返回到向量[0] 如果可能的话,我想在以后的向量上启动计时器。计时器在最后停止Actionscript 3 AS3/在向量处停止计时器?,actionscript-3,flash,vector,timer,Actionscript 3,Flash,Vector,Timer,如何在向量[2]处启动计时器并在向量[13]处停止计时器myTimer.stop() 我已经做了,向量每10秒跳到下一个向量(timerevent)。计时器和向量将继续计数,然后返回到向量[0] 如果可能的话,我想在以后的向量上启动计时器。计时器在最后停止 var myTimer:Timer = new Timer(1000); myTimer.repeatCount = 13; myTimer.delay = 1000; myTimer.addEventListener(TimerEvent
var myTimer:Timer = new Timer(1000);
myTimer.repeatCount = 13;
myTimer.delay = 1000;
myTimer.addEventListener(TimerEvent.TIMER, countdownHandler);
function countdownHandler(event:TimerEvent):void
{
countdown.text = 0+myTimer.currentCount+" s remaining";
countdown2.text = 0+myTimer.currentCount+" s remaining";
if(myTimer.currentCount==10)
{
myTimer.reset();
myTimer.start();
}
}
myTimer.start();
&
函数timerfuncie(事件:TimerEvent)
{
对于(变量i:int=0;i
不确定在何处调用timerfunctie,但此代码应检测计时器的currentCount何时为2和13。如果希望计时器运行完整的13次迭代,则不希望在迭代10时重置计时器
function countdownHandler(event:TimerEvent):void
{
countdown.text = 0+myTimer.currentCount+" s remaining";
countdown2.text = 0+myTimer.currentCount+" s remaining";
if (myTimer.currentCount==2) {
// start with vector[2]
} else if (myTimer.currentCount==13) {
// end with vector[13]
}
}
function countdownHandler(event:TimerEvent):void
{
countdown.text = 0+myTimer.currentCount+" s remaining";
countdown2.text = 0+myTimer.currentCount+" s remaining";
if (myTimer.currentCount==2) {
// start with vector[2]
} else if (myTimer.currentCount==13) {
// end with vector[13]
}
}