Flex桌面程序(入门)之绘制一个移动的圆

package
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(width="400", height="300", frameRate="30")]
	public class MyDemo extends Sprite
	{
		private var circle:Shape;
		public function MyDemo()
		{
			circle = new Shape();
			circle.x = 50;
			circle.y = 100;
			addChild(circle);
			circle.graphics.beginFill(0xee2f2f);
			circle.graphics.drawCircle(circle.x,circle.y,40);
			circle.addEventListener(Event.ENTER_FRAME,changePos);
		}
		
		public function changePos(event:Event):void
		{
			if(circle.y >= 300)
			{
				circle.y = 1;
			}else if(0<circle.y && circle.y < 300)
			{	
				circle.y+=5;
			}
		}
	}
}


posted @ 2014-02-27 11:04  Mr轨迹  阅读(299)  评论(0编辑  收藏  举报