package  
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class Main extends Sprite
	{
		private var animatedCursor:AnimatedCursor;
		
		public function Main() 
		{
			button.addEventListener(MouseEvent.CLICK, onButtonClick);
			stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
			
			animatedCursor = new AnimatedCursor();
			animatedCursor.mouseEnabled = false;
			animatedCursor.mouseChildren = false;
			addChild(animatedCursor);
		}
		
		private function onMouseMove(e:MouseEvent):void 
		{
			animatedCursor.updateCursorPosition(mouseX, mouseY);
		}
		
		private function onButtonClick(e:MouseEvent):void 
		{
			if (!animatedCursor.isRunning)
			{
				animatedCursor.start();
			} else
			{
				animatedCursor.stop();
			}
		}
	}
}