package classes.matuto.social.facebook
{
	
	//Matuto
	import classes.com.stimuli.loading.BulkLoader;
	import classes.com.stimuli.loading.BulkProgressEvent;
	import classes.fl.motion.easing.*;
	import classes.greensock.*;
	import classes.matuto.core.*;
	import classes.matuto.core.module.*;
	import classes.matuto.interfaces.*;
	import classes.matuto.loaders.*;
	import classes.matuto.model.*;
	import classes.matuto.mtween.textinho.*;
	import classes.matuto.utils.display.*;
	import classes.matuto.utils.model.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.net.URLRequest;
	import flash.net.URLVariables;
	import flash.utils.*;
	
	
	
	public class FacebookImage extends Sprite
	{
		
		
		public  var params:Object = new Object();
		public  var bitmap:*
		
		public function FacebookImage()
		{			
		
		}
	
		public function init() :void
		{
			loadMyPicture();
		}
		
		private function loadMyPicture():void
		{
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMyPictureLoaded, false, 0, true);    
			
			var url:String;
			
			if(!Facebook.getInstance().local)
			url = "php/facebook/Proxy.php"
			else
			Matuto.getConfig.getServer+"php/facebook/Proxy.php";	
				
			var request:URLRequest 		= new URLRequest(url);
			var variables:URLVariables 	= new URLVariables();
			variables.path 			    = params.path;
			request.data 				= variables;
			
			loader.load(request);
		}
		
		private function onMyPictureLoaded(event:Event):void
		{
			var loader:Loader = event.target.loader;
			loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onMyPictureLoaded);
			
			bitmap			  = Bitmap(loader.content);
			
			bitmap.smoothing  	  =	true;
			addChild(bitmap);
			
			dispatchEvent(new Event(Event.COMPLETE));
		}    
		
		
		
	
		
	}//end class
}