package modules.noticias  
{
	import com.freshplanet.lib.ui.scroll.mobile.ScrollController;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.geom.Rectangle;
	import flash.text.TextFieldAutoSize;
	import classes.fl.motion.easing.*;
	import classes.greensock.*;
	import classes.matuto.core.*;
	import classes.matuto.core.module.*;
	import classes.matuto.events.*;
	import classes.matuto.interfaces.*;
	import classes.matuto.model.*;
	import classes.matuto.mtween.textinho.*;
	import classes.matuto.ui.*;
	import classes.matuto.utils.display.*;
	import classes.matuto.utils.model.*;	
	import modules.home.*;
	import modules.menu.*;	
	import flash.utils.setTimeout;
	
	public class NoticiasInterna extends MovieClip 
	{
		
		public static var MODEL:Object;
		private var _scroll:ScrollController;

		
		public function NoticiasInterna() 
		{
			super();
			
			addEventListener(Event.ADDED_TO_STAGE, add);
			addEventListener(Event.REMOVED_FROM_STAGE,remove)
		}
		
		private function remove(e:Event):void 
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, remove);
			MODEL = null;
			
			
			_scroll.removeScrollControll();
			_scroll = null;
		}
		
		private function add(e:Event):void 
		{
			
			x = 1336;

						
			_c._thumb._mais.visible = false;
		
			removeEventListener(Event.ADDED_TO_STAGE, add);
			_c._texto.wordWrap = true;
			_c._texto.multiline = true;
			_c._texto.autoSize = TextFieldAutoSize.LEFT;
			_c._texto.height = _c._texto.textHeight;
			_c._texto.htmlText  =  MODEL.text;

			_c._thumb.setModel(MODEL);
			var containerViewport:Rectangle = new Rectangle(0, 115,stage.stageWidth,stage.stageHeight);
			this._scroll = new ScrollController();
			this._scroll.horizontalScrollingEnabled = false;
			this._scroll.addScrollControll(_c, _c, containerViewport);
			
			TweenMax.to(this,.6,{x:0,ease:Exponential.easeInOut,onComplete:function(){}});
			
			_voltar.addEventListener(Event.SELECT, onVoltar);
			
		}
		
		private function onVoltar(e:Event):void 
		{
			
			TweenMax.to(this,.6,{x:1360,autoAlpha:0,ease:Exponential.easeInOut,onComplete:function(){}});
			
			setTimeout(function() { 
			
				dispatchEvent(new Event(Event.CLOSE));
				
		    }, 400);
			
		}
		
		
		
		
		
		
	}//END CLASS

}