本地时间使用与倒计时
package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.utils.setInterval; import flash.utils.Timer;
/* *author : SinSoul *blogs: http://www.cnblogs.com/sinsoul */ public class Main extends MovieClip { private var a:Number; private var b:Number; private var c:Number; private var T1:Number; private var T2:Number; private var T3:Number; private var bool:Boolean; public function Main():void { init(); } private function init():void { bool=true; setInterval(aa,1000); btn.addEventListener(MouseEvent.CLICK,onMouseEvent); } private function aa():void { var date:Date =new Date(); txt.text=date.hours+":"+date.minutes+':'+date.seconds; //i--; //txt.text=String(i); //trace(1); } private function onMouseEvent(e:MouseEvent):void { a=Number(txt1.text); b=Number(txt2.text); c=Number(txt3.text); //T1=Number(txt1.text); //T2=Number(txt2.text); //T3=Number(txt3.text); if (bool==true) { setInterval(daojishi,1000); bool=false; } } private function daojishi() { if (a>23) { a=23; } if (b>59) { b=59; } if (c>59) { c=59; } if (c==-1) { c=59; } c--; onIf(); } private function onIf():void { if (c==-1) { if (b==-1) { b=59; a-=1; } //trace(b); b=b-1; //trace(b); c=59; if (b==-1) { a=a-1; b=59; } if (a==-1) { //trace(a); a=23; //trace(a); } } txt6.text=String(c); txt5.text=String(b); txt4.text=String(a); } } }