package engine
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	/**
	 * ...
	 * @author beisik
	 */
	public class Button extends Sprite 
	{
		public var label: Label;
		private var func: Function;
		public var id: int;
		
		public function Button(x: Number, y: Number, text: String, func: Function, color: uint = 0xFFFFFF, font: String = "", size: int = 0) 
		{
			this.x = x;
			this.y = y;
			this.func = func;
			this.buttonMode = true;
			this.id = id;
			
			label = new Label(0, 0, text, color, font, size);
			addChild(label);
			
			this.addEventListener(MouseEvent.CLICK, onMouseClick);
		}
		
		private function onMouseClick(e: MouseEvent): void
		{
			func();
		}
		
	}

}