AS3.0 中秋倒计时

//注意,事件timer必须全部小写; stage.addEventListener(Event.ENTER_FRAME,djsTime); top_text.x=15; top_text.y=16; function djsTime(event:Event):void { var date:Date= new Date(); var date_jieshu:Date = new Date(2010,8,23,0,0,1); var shijiancha:Number=(date_jieshu.getTime()-date.getTime())/1000; if (shijiancha > 0) { var shengyutian:uint=uint(shijiancha/(3600*24)); var shengyuxiaoshi:uint=uint((shijiancha-shengyutian*3600*24)/3600); var shengyufen:uint=uint((shijiancha-shengyutian*24*3600-shengyuxiaoshi*3600)/60); //分钟补零 if (shengyufen < 10) { var endMinute = "0" + shengyufen; } else { endMinute = shengyufen; } var allhour:uint = shengyutian * 24 + shengyuxiaoshi; //小时补零 if (allhour < 10) { var endhour = "0" + allhour; } else { endhour = allhour; } var shengyumiao:Number = Math.floor(shijiancha - shengyutian * 24 * 3600 - shengyuxiaoshi * 3600 - shengyufen * 60); if (shengyumiao < 10) { var endSecond = "0" + shengyumiao; } else { endSecond = shengyumiao; } chaDate.text = endhour + " " + endMinute + " " + endSecond; } else { chaDate.text = "00 00 00"; stage.removeEventListener(Event.ENTER_FRAME,djsTime); } }

 

 

你可能感兴趣的:(date,360,timer,function,2010,as3.0,学习)