Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 AS3/在向量处停止计时器?_Actionscript 3_Flash_Vector_Timer - Fatal编程技术网

Actionscript 3 AS3/在向量处停止计时器?

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

如何在向量[2]处启动计时器并在向量[13]处停止计时器<代码>myTimer.stop()

我已经做了,向量每10秒跳到下一个向量(timerevent)。计时器和向量将继续计数,然后返回到向量[0]

如果可能的话,我想在以后的向量上启动计时器。计时器在最后停止

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]
    }
}