package classes.matuto.social
{
	
	
	import classes.matuto.core.Matuto;
	import classes.matuto.model.Model;
	
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import flash.system.*;

	
	public class Twitter  extends Sprite
	{
		
		public static	 const COMPLETE		:String = "complete";
		private  		 var   xmlList     	:XMLList;
         
		public function Twitter()
		{
			policia();		
		}
		
		public function init():void
		{
			var url:String = Matuto.getConfig.getServer+"php/twitter.php?"+"nome="+Matuto.getConfig.getTwitter
			Model.XML_CONNECT(url,complete);
		}
		
		private function complete(value:XML):void
		{	
			xmlList = value.status;			
			dispatchEvent(new Event(COMPLETE));
		}
		
		private function policia():void
		{
			Security.loadPolicyFile(Matuto.getConfig.getServer+"visao/xml/seguranca/twitter.xml");
		}
		
		public function get getDados():XMLList
		{
		   return xmlList;
		}
		
		/*
		 * 
		
			private var tw:Twitter = new Twitter();
	
			tw.addEventListener(Twitter.COMPLETE,onCompleteTwitter);
			tw.init();
			
			private function onCompleteTwitter(e:Event):void
			{
				trace(tw.getDados);
			}
		
		
		*/
	
			
	}//end class
	
}