forked from: flash on 2010-5-7

by umhr
♥0 | Line 47 | Modified 2010-05-07 20:09:52 | MIT License
play

ActionScript3 source code

/**
 * Copyright umhr ( http://wonderfl.net/user/umhr )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/zL8A
 */

package{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;

	public class Main extends Sprite{
		private var _maru:Sprite;
		private var _maru2:Sprite;
		private var _maru3:Sprite;
		private var tf:TextField;
		public function Main(){
			
			

			_maru = new Sprite();
			_maru.graphics.beginFill(0xFF0000);
			_maru.graphics.drawCircle(0,-180,10);
			_maru.graphics.endFill();
			_maru.x = stage.stageWidth/2;
			_maru.y = stage.stageHeight/2;
			this.addChild(_maru);


			_maru2 = new Sprite();
			_maru2.graphics.beginFill(0x00FF00);
			_maru2.graphics.drawCircle(0,-10,40);
			_maru2.graphics.endFill();
			_maru2.x = stage.stageWidth/2;
			_maru2.y = stage.stageHeight/2;
			this.addChild(_maru2);

			_maru3 = new Sprite();
			_maru3.graphics.beginFill(0x0000FF);
			_maru3.graphics.drawCircle(0,-180,10);
			_maru3.graphics.endFill();
			_maru3.x = stage.stageWidth/2;
			_maru3.y = stage.stageHeight/2;
			this.addChild(_maru3);

			tf = new TextField();
			
			tf.selectable = false;
			tf.x = 200;
			tf.y = 200;
			this.addChild(tf);
			
			this.addEventListener(Event.ENTER_FRAME,onEnter);
		}

		private function onEnter(event:Event):void{
			var date:Date = new Date();
			//_maru.rotation = date.getSeconds()*6;
			_maru.rotation = date.getSeconds()*6+date.getMilliseconds()*(6/1000)
			_maru2.rotation = date.getSeconds()*6+0.1;			
			_maru3.rotation = date.getSeconds()*6*1.8;

			tf.text = String(date.getSeconds());
			/*
			var tf:TextField = new TextField();
			tf.text = date;
			tf.selectable = false;
			tf.x = 200;
			tf.y = 200;
			this.addChild(tf);
			*/
			//_maru3.rotation = date.getSeconds()*5;
			//trace(date.getMinutes(),date.getHours());
		}
	}
}