从计时器actionscript 2.0中减去

时间:2013-01-12 05:53:06

标签: actionscript-2 countdowntimer subtraction

我有我的计时器代码

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;

是吗?谁能帮我。请吗

1 个答案:

答案 0 :(得分:0)

dispSecs += -10;

dispSecs = dispSecs - 10;