钟表单摆

package {
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.display.Shape;

	/*
	      *author : SinSoul 
	      *blogs: http://www.cnblogs.com/sinsoul
	 
	*/
	public class bai extends MovieClip {

		var vx:Number=0;
		var hd:Number=0;

		public function bai() {
			var shape:Shape = new Shape();
			this.addEventListener(Event.ENTER_FRAME,onhandler);
			function onhandler(e) {
				shape.graphics.clear();
				shape.graphics.lineStyle(2,0x000000);
				shape.graphics.moveTo(250,50);
				shape.graphics.lineTo((250+100*Math.sin(hd)),Math.sqrt(200*200-((250+100*Math.sin(hd))-250)*((250+100*Math.sin(hd))-250)));
				addChild(shape);
				shape.graphics.beginFill(0x000000);
				shape.graphics.drawCircle((250+100*Math.sin(hd)),Math.sqrt(200*200-((250+100*Math.sin(hd))-250)*((250+100*Math.sin(hd))-250)),20);
				shape.graphics.endFill();
				addChild(shape);
				hd+=0.1;
			}
		}

	}
}

 

posted @ 2010-11-04 18:36  sinsoul  阅读(371)  评论(0编辑  收藏  举报