0

我的计时器有这个代码

dt_timer.text = "02:00";
var dispSecs = 60;
var dispMins = 2;

var timerInterval = setInterval(countDown, 1000);

function countDown()
{

    dispSecs--;

    if(dispSecs==59)
    {
        dispMins--;
    }

    if(dispSecs==0 && dispMins > 0)
    {
        dispSecs = 60;
    }

    if(dispSecs==0)
    {
        gotoAndPlay(200);
        clearInterval(timerInterval);
    }

    if(dispSecs == 60)
    {
        dt_timer.text = prependZero(dispMins) + ":" + prependZero(0);
    }
    else
    {
        dt_timer.text = prependZero(dispMins) + ":" +prependZero(dispSecs);
    }
}
function prependZero(num)
{
if (num < 10)
{
    num = "0" + num;
}
return (num);
}

我有按钮,当点击它会从计时器中减去 10 秒。我正在考虑在我的按钮中使用此代码

dispSecs - 10;

那正确吗?谁能帮我。请?

4

1 回答 1

0
dispSecs += -10;

或者

dispSecs = dispSecs - 10;
于 2013-01-12T05:54:06.780 回答