package game.GameMenu
{
	import flash.display.Bitmap;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flinjin.input.Input;
	
	/**
	 * ...
	 * @author Michael Miriti
	 */
	public class GameMenuItemSwitch extends GameMenuItem
	{
		private var _on:int = 0;
		private var _off:int = 1;
		
		public function GameMenuItemSwitch(spriteBmp:Bitmap, rotationCenter:Point = null, animated:Boolean = false, frameWidth:uint = 0, frameHeight:uint = 0, frameRate:Number = 1)
		{
			super(spriteBmp, rotationCenter, animated, frameWidth, frameHeight, frameRate);
			
			addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
		}
		
		public function isOn():Boolean
		{
			return _on == 0;
		}
		
		private function onMouseDown(e:MouseEvent):void
		{
			if (_on == 1)
			{
				_on = 0;
				_off = 1;
			}
			else
			{
				_on = 1;
				_off = 0;
			}
			
			currentFrame = isOn() ? 0 : 1;
		}
		
		override public function Move():void
		{
		/*if ((Input.MousePosition.x >= x) && (Input.MousePosition.x <= x + width) && (Input.MousePosition.y >= y) && (Input.MousePosition.y <= y + height))
		   {
		   currentFrame = _off;
		   }
		   else
		   {
		   currentFrame = _on;
		 }*/
		}
	
	}

}