package classes.matuto.ui.Mt
{
	import classes.gustavo.events.AlertEvent;
	import classes.gustavo.ui.alert.Alert;
	import classes.gustavo.ui.box.Box;
	import classes.matuto.core.Index;
	import classes.matuto.events.MatutoEvent;
	import classes.matuto.ui.scroll.MtScrollBar;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.utils.setTimeout;
	
	
	public class AddAlert
	{
		
		
		public static var alert:Alert;
		
		public static function add(_texto:String="Aviso")
		{
			alert = new Alert(_texto,Alert.SIMPLE,4);
				
			alert.addEventListener(AlertEvent.CLOSE,function(AlertEvent):void
			{
				Site.ref.removeChild(alert);
				alert = null;
			});
			
			Site.ref.addChild(alert);
			Site.ref.setChildIndex(alert,Site.ref.numChildren - 1);
		
		}
		
		public static function close()
		{
			alert.close();
			
			setTimeout(function():void{
			
				if(alert)
				{
				 Site.ref.removeChild(alert);
				 alert = null;
				}
			},1000);
			
		}
		
		
		
	}//end class
	
}