package
{
	import flash.display.NativeMenu;
	import flash.events.KeyboardEvent;
	
	/**
	 * ...
	 * @author Michael Miriti
	 */
	public class Catscene
	{
		private var _time:Number
		private var _info:String;
		private var _name:String;
		
		public var callback:Function = null;
		
		public function Catscene(name:String, info:String, time:Number)
		{
			_name = name;
			_info = info;
			_time = time;
			
			Main.i.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
		}
		
		private function onKeyDown(e:KeyboardEvent):void
		{
			if (callback != null)
			{
				callback.call();
				Main.i.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
			}
		}
		
		public function update(dt:Number):void
		{
			if (_time <= 0)
			{
				if (callback != null)
				{
					callback.call();
					Main.i.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
				}
			}
			else
			{
				Main.i.clear();
				Main.i.setString((80 - _name.length) / 2, 10, _name, 12);
				Main.i.setString((80 - _info.length) / 2, 12, _info, 15);
				_time -= dt;
			}
		}
	
	}

}