In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

へんなとけい

Get Adobe Flash player
by undo 22 Jul 2009
/**
 * Copyright undo ( http://wonderfl.net/user/undo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/AeCJ
 */

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	public class FlashTest extends Sprite
	{

		private var hor:Sprite = new Sprite();
		private var min:Sprite = new Sprite();
		private var sec:Sprite = new Sprite();
		private var horLength:Number = 130;
		private var minLength:Number = 160;
		private var secLength:Number = 180;
		public function FlashTest()
		{
			// write as3 code here..
			// 短針の先に長針が付いてて、長針の先に秒針がついてる
			// へんな時計

			//graphics.lineStyle(3,0xcccccc);
			//graphics.drawCircle(stage.stageWidth/2, stage.stageHeight/2, Math.min(stage.stageWidth, stage.stageHeight)/2-50);

			addChild(hor);
			addChild(min);
			addChild(sec);

			hor.graphics.beginFill(0);
			hor.graphics.drawRect(-10,10,20,-horLength-20);
			hor.graphics.endFill();
			min.graphics.beginFill(0x333333);
			min.graphics.drawRect(-8,8,16,-minLength-16);
			min.graphics.endFill();
			sec.graphics.beginFill(0x999999);
			sec.graphics.drawRect(-4,30,8,-secLength-30);
			sec.graphics.endFill();

			hor.x = stage.stageWidth/2;
			hor.y = stage.stageHeight/2;

			addEventListener(Event.ENTER_FRAME, onEnter);
		}

		private function onEnter(evt:Event):void
		{
			var date:Date = new Date();
			var h:Number = date.getHours();
			var m:Number = date.getMinutes();
			var s:Number = date.getSeconds();

			hor.rotation = 360*(h+m/60)/12;

			min.x = hor.x + Math.sin(Math.PI*hor.rotation/180)*horLength;
			min.y = hor.y - Math.cos(Math.PI*hor.rotation/180)*horLength;
			min.rotation = 360*(m+s/60)/60;

			sec.x = min.x + Math.sin(Math.PI*min.rotation/180)*minLength;
			sec.y = min.y - Math.cos(Math.PI*min.rotation/180)*minLength;
			sec.rotation = 360*(s + date.getMilliseconds()/1000)/60;
		}
	}
}