如何在Swish上的倒计时中的特定时间更改颜色? onSelfEvent(加载) { 变量开始:String=“02:00”; result.text=开始; _global.min=int(start.slice(0,2)); _global.sec=int(start.slice(3,5)); var timerInterval:数字; 变量未激活:布尔值=真; var keyListener:Object=新对象(); keyListener.onKeyDown=函数()//按下键 { if(not_active)//按键时检查倒计时是否未激活,if true=开始/恢复 { if(Key.isDown(32))//按键 { //跟踪(“活动”); timerInterval=设置间隔(计数器,1000); 未激活=错误; } } 否则//暂停 { //跟踪(“暂停”); clearInterval(timerInterval); 未激活=真; } } Key.addListener(keyListener);//向Key对象注册侦听器,以便它可以接收来自Key down和Key up事件的通知。 } 函数计数器():void { //跟踪(“min=”添加min); //跟踪(“sec=”添加sec); //跟踪(“typeof min=“add typeof min add”typeof sec=“add typeof sec”) 如果(秒==0) { if(min==0)//如果sec=0且min=0 { clearInterval(timerInterval);//clearintervam } else//如果sec=0,min!=0 { 秒=59; min--;//min=min-1 } } 其他的 { 秒--;//秒=秒-1 } result.text=zero_check(min)add:“add zero_check(sec);//小于10的数字加0 } 函数零点检查(检查:int) { 如果(检查
我希望我的倒计时计时器在达到59秒时变成橙色,在达到30秒时变成红色,但它不工作,我现在不知道为什么,我正在使用Swish,我不知道它使用什么语言编写脚本如何在Swish上的倒计时中的特定时间更改颜色? onSelfEvent(加载) { 变量开始:String=“02:00”; result.text=开始; _global.min=int(start.slice(0,2)); _global.sec=int(start.slice(3,5)); var timerInterval:数字; 变量未激活:布尔值=真; var keyListener:Object=新对象(); keyListener.onKeyDown=函数()//按下键 { if(not_active)//按键时检查倒计时是否未激活,if true=开始/恢复 { if(Key.isDown(32))//按键 { //跟踪(“活动”); timerInterval=设置间隔(计数器,1000); 未激活=错误; } } 否则//暂停 { //跟踪(“暂停”); clearInterval(timerInterval); 未激活=真; } } Key.addListener(keyListener);//向Key对象注册侦听器,以便它可以接收来自Key down和Key up事件的通知。 } 函数计数器():void { //跟踪(“min=”添加min); //跟踪(“sec=”添加sec); //跟踪(“typeof min=“add typeof min add”typeof sec=“add typeof sec”) 如果(秒==0) { if(min==0)//如果sec=0且min=0 { clearInterval(timerInterval);//clearintervam } else//如果sec=0,min!=0 { 秒=59; min--;//min=min-1 } } 其他的 { 秒--;//秒=秒-1 } result.text=zero_check(min)add:“add zero_check(sec);//小于10的数字加0 } 函数零点检查(检查:int) { 如果(检查,timer,countdown,countdowntimer,swish,Timer,Countdown,Countdowntimer,Swish,我希望我的倒计时计时器在达到59秒时变成橙色,在达到30秒时变成红色,但它不工作,我现在不知道为什么,我正在使用Swish,我不知道它使用什么语言编写脚本 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 :
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;
}}