1
onSelfEvent (load) 
{ 
var start : String = "02:00"; 
result.text = start; 
_global.min = int(start.slice(0,2)); 
_global.sec = int(start.slice(3,5)); 
var timerInterval : Number; 
var not_active : Boolean = true; 

var keyListener : Object = new Object(); 
keyListener.onKeyDown = function() //on key down  
{ 
    if (not_active) //check if countdown not_active onkeypress , if true =             start/resume 
    { 
        if (Key.isDown(32)) //keypress  
        { 
            //trace("active"); 
            timerInterval = setInterval(counter, 1000); 
            not_active = false; 
        } 
    } 
    else //pause 
    { 
        //trace("pause"); 
        clearInterval(timerInterval); 
        not_active = true; 
    } 
}    
Key.addListener(keyListener); //register the listener with the Key object so that it can receive notification from the key down and key up events. 
} 
function counter() : void 
{ 
//trace("min = " add min); 
//trace("sec = " add sec); 
//trace("typeof min = " add typeof min add " typeof sec = " add typeof sec) 
if(sec == 0) 
{ 
    if(min == 0) //if sec = 0 and min = 0
    { 
        clearInterval(timerInterval); //clearintervam 
    } 
    else //if sec = 0 and min != 0
    { 
        sec = 59; 
        min --; // min = min - 1 
    } 
} 
else 
{ 
    sec --; //sec = sec - 1         
} 
result.text = zero_check(min) add ":" add zero_check(sec); //less than 10 add a 0 to number
 } 
function zero_check(check : int) 
 { 
if(check < 10) 
{ 
    check = "0" add check; //add a 0
} 
return(check); 
}
onSelfEvent (load){

clock=Math.floor(getTimer()/100)/10;
 /* if (seconds==0) {
    seconds=600;
    minute--
}
if (x!=clock) {
    seconds--
}*/
x=clock;
if (var ==00 && var ==59) {
    result.textColor = 0xFF9900;
}}

我想让我的倒数计时器在达到 59 秒时变为橙色,在达到 30 秒时变为红色,但它不起作用,我现在不知道为什么,我正在研究 Swish 我不知道它使用什么语言编写脚本。

4

0 回答 0