xmlns:s&#61;"library://ns.adobe.com/flex/spark"xmlns:mx&#61;"library://ns.adobe.com/flex/mx"width&#61;"486" height&#61;"82" creationComplete&#61;"init()" fontWeight&#61;"bold">[CDATA[import flash.events.Event;import flash.events.TimerEvent;import flash.media.Sound;import flash.media.SoundChannel;import flash.utils.Timer;import mx.controls.Alert;import mx.events.CloseEvent;import mx.events.ColorPickerEvent;private var timer:Timer;public var h_num:int&#61;0;public var m_num:int&#61;0;public var s_num:int&#61;10;public var sumit:Function;private function init():void{this.timeComplete();timer &#61; new Timer(1000, 0);timer.addEventListener(TimerEvent.TIMER, onTimer);timer.start();}private function onTimer(event:TimerEvent):void{s_num &#61; s_num - 1;if ((s_num &#61;&#61; -1) && (m_num > 0)) {m_num &#61; m_num - 1;s_num &#61; 59;}if ((m_num &#61;&#61; 0) && (h_num > 0)){h_num &#61; h_num -1;m_num &#61; 59;s_num &#61; 59;}if(s_num<30 && h_num&#61;&#61;0 && m_num&#61;&#61;0){tip.text&#61;"距离考试结束还有"&#43;s_num&#43;"秒&#xff0c;请您尽快提交当前题的答案哦&#xff01;";}if (s_num <0){s_num &#61; 0;timer.stop();Alert.yesLabel &#61; "确定";Alert.show("考试结束时间到&#xff01;", "提示", Alert.YES, this, function(event:CloseEvent):void{var flag:int &#61; event.detail;if(flag &#61;&#61; Alert.YES){
Alert.show("YES");
//sumit.call();}});}var hh:String;var mm:String;var ss:String;hh &#61; (h_num <10) ? "0" &#43; h_num.toString() : h_num.toString();mm &#61; (m_num <10) ? "0" &#43; m_num.toString() : m_num.toString();ss &#61; (s_num <10) ? "0" &#43; s_num.toString() : s_num.toString();time2_txt.text &#61; time_txt.text &#61; hh &#43; "小时" &#43; mm &#43; "分" &#43; ss&#43;"秒"; }private function timeComplete():void{var hh:String;var mm:String;var ss:String;hh &#61; (h_num <10) ? "0" &#43; h_num.toString() : h_num.toString();mm &#61; (m_num <10) ? "0" &#43; m_num.toString() : m_num.toString();ss &#61; (s_num <10) ? "0" &#43; s_num.toString() : s_num.toString();time2_txt.text &#61; time_txt.text &#61; hh &#43; ":" &#43; mm &#43; ":" &#43; ss; }]]> fontWeight&#61;"bold"/>fontWeight&#61;"bold" text&#61;"距离考试结束还有&#xff1a;"/>