package  {
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class Checkbox extends MovieClip
	{
		public var Enabled:Boolean = true;
		public function Checkbox()
		{
			checkbox.gotoAndStop(1);
			checkbox.addEventListener(MouseEvent.CLICK, Clicked);
		}

		protected function Clicked(event)
		{
			if (!Enabled) return;
			Toggle();
			if (OnClick != null) OnClick(OnClickParam);
		}
		
		protected var checked = false;
		public function set Checked(value) { checked = value; checkbox.gotoAndStop(checked ? 2 : 1); }
		public function get Checked() { return checked; }		

		public function set Text(value) { text.text = value; }
		
		public var OnClickParam;
		public var OnClick;

		
		public function Toggle()
		{
			checked = !checked;
			checkbox.gotoAndStop(checked ? 2 : 1);
			
			
		}
		
	}
	
}
