zoukankan      html  css  js  c++  java
  • 本地时间使用与倒计时

    
    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);
    		}
    	}
    }
    

     

     

  • 相关阅读:
    CREATE VIEW
    CREATE USER
    安全层次
    PHP json_decode 函数解析 json 结果为 NULL 的解决方法
    Java实现 LeetCode 7整数反转
    Java实现 LeetCode 6 Z字形变换
    Java实现 LeetCode 6 Z字形变换
    Java实现 LeetCode 6 Z字形变换
    Java实现 LeetCode 5 最长回文子串
    Java实现 LeetCode 5 最长回文子串
  • 原文地址:https://www.cnblogs.com/sinsoul/p/1871229.html
Copyright © 2011-2022 走看看