troubleshooting Question

Papervision 2.0 MovieMaterials and flickr dynamic images

Avatar of MikeSven
MikeSvenFlag for Canada asked on
Adobe Flash
1 Comment1 Solution1544 ViewsLast Modified:
Hey Guys,

I am trying to load in some dynamic images from flickr and display them on some planes.  I currently have all of the xml information being fed into my system, and can display the images with out papervision.  I seem to be having a few issues setting up my MovieMaterial so that it is working properly.  If i trace a few things out, it looks like the flickr image is fully loaded in, but for some reason I can't get the data to show in the material.  I have also tested using some color materials just to make sure my basic 3d code is working and it all is.  I was wondering if perhaps there is anyone out there who has tried this before and can lend me a hand or lead me in the right direction.  I have built an ImageObject class, which exteds DO3D and should display a plane with the image on it the code that I am currently using is as follows:

Thanks for any help that can be offered.

Michael
package ImageGallery
{
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.ProgressEvent;
	import flash.net.URLRequest;
	import flash.system.LoaderContext;
	
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.materials.MovieMaterial;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.primitives.Plane;
	
	public class ImageObject extends DisplayObject3D
	{
		private  var   imageLoader:Loader;
		private  var   imageRequest:URLRequest;
		private  var   imageContainer:MovieClip;
		
		public   var   thePlane:Plane;
		public   var   thePlaneHolder:DisplayObject3D
		public   var   thePlaneMat:MovieMaterial;
		
		private  static   const   FLICKR_IMAGE_LOADED:String = "THIS IMAGE HAS LOADED";
		
		public function ImageObject(fileURL:String)
		{
			initLoad(fileURL);
		}
		
		private function initLoad(fileURL:String):void{
			
			imageRequest = new URLRequest(fileURL);
			
			imageLoader = new Loader();
			imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, handleImageLoadProg);
			imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleImageLoadComplete);
			imageLoader.load(imageRequest, new LoaderContext(true));
			
		}
		
		private function handleImageLoadComplete(e:Event):void{
			
			imageContainer = new MovieClip();
			imageContainer.addChild(imageLoader.content);
			
			addEventListener(FLICKR_IMAGE_LOADED, startMaterialBuild);
			dispatchEvent(new Event(FLICKR_IMAGE_LOADED));
			
		}
		
		private function handleImageLoadProg(e:ProgressEvent):void{
			trace(e.bytesLoaded / e.bytesTotal);
		}
		
		private function startMaterialBuild(e:Event):void{
 
			thePlaneMat = new MovieMaterial(imageContainer, false, true, true);;
			startPlaneBuild(thePlaneMat);
			
		}
		
		private function startPlaneBuild(thePlaneMaterial:MovieMaterial):void{
			
			var tempMat:ColorMaterial = new ColorMaterial(0xFFFFFF);
			thePlane = new Plane(thePlaneMat, 100, 100, 10, 10);
			thePlaneHolder = addChild(thePlane);
			
		}
 
	}
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros