我有我的计时器代码
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;
是吗?谁能帮我。请吗
答案 0 :(得分:0)
dispSecs += -10;
或
dispSecs = dispSecs - 10;