package code
{
	/*****************************************
	
	 * Demonstrates using the Date object to create a clock.
	
	 ****************************************/
	 
	import flash.events.Event;
	import flash.display.MovieClip;
	
	public class DTime extends MovieClip
	{
		//*************************
		// Properties:
		
		public var now:Date;
		public var tweek:Array = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
		//*************************
		// Constructor:
		
		public function DTime()
		{
			// Update screen every frame
			addEventListener(Event.ENTER_FRAME,enterFrameHandler);
		}
		
		//*************************
		// Event Handling:
		
		protected function enterFrameHandler(event:Event):void
		{
			now = new Date();
			//trace(now.fullYear+"年",(now.month+1).toString()+"月",now.date.toString()+"日" );
//			trace(tweek[now.day]);
			todayear_txt.text = now.fullYear+"年";
			todaymonth_txt.text = (now.month+1).toString()+"月";
			todayday_txt.text = now.date.toString()+"日";
			todayweek_txt.text = tweek[now.day]

			// Rotate clock hands and shadows
			hourHand_mc.rotation = now.getHours()*30+(now.getMinutes()/2);
			//hourHandShadow_mc.rotation = now.getHours()*30+(now.getMinutes()/2);
			minuteHand_mc.rotation = now.getMinutes()*6+(now.getSeconds()/10);
			//minuteHandShadow_mc.rotation = now.getMinutes()*6+(now.getSeconds()/10);
			secondHand_mc.rotation = now.getSeconds()*6;
			//secondHandShadow_mc.rotation = now.getSeconds()*6;
		}
		
		
	}
}