package  classes.matuto.mtween.textinho
{
	
	import classes.caurina.transitions.Tweener;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;

	public class Linha extends Sprite
	{
		public var txt 		:TextField;
		public var _mask	:Sprite;
		private var time	:Number;
		
		public var onClose	:Function;
		
		private var pw		:int;
		
		public function Linha()
		{	
			txt 				= _txt;
			_mask 				= _mascara;			
			
			
			txt.autoSize 		= "left";
			_mask.width = 0;			
			_mask.mouseEnabled  = false;	
		}
		
		
		public function init( time :Number = 0) :void
		{
			time 		= time + this.time;
			pw			= int(txt.width + 6);
			anime();
		}
		
		public function setTextinho(texto :String, time :Number) :void
		{	
			txt.htmlText 		= texto.substr(0, 1)!=" "?texto:texto.substr(1, texto.length);
			this.time 			= time;
		}
		
		
		public function mudaFonte(t:Number):void
		{
			var formt:TextFormat 			= new TextFormat();
			formt.size 						= 2;
			formt.font 						= "arial"
			formt.color 					= 0xFF0080;
			
			txt.setTextFormat(formt);
			
			_mask.height 					= 30;

			
		}
		
		public function anime():void
		{
			Tweener.addTween(_mask, { width:pw, time:.5, transition:"easeInoutQuint", delay:time + 0.2 } );
		}
		
		public function close(time :Number) :void
		{
			Tweener.addTween(_mask, {width:0, time:2, transition:"easeOutQuint", delay:time });
		}
		
		
	}//end class
	
}