Loading external SWF problems (PaperVision)

Hi guys,

I am having some issues creating a carousel type menu, I am using papervision and am adapting a tutorial to suit my needs. Basically the menu rotates whenever a plane is clicked on, spinning it into position, what I also need to happen is for an external swf to load in underneath it - and here is where I run into the problems.

So far I have this in place:

private function doPress(event:Event):void{
			
			var plane:Plane = planeByContainer[ event.target ];
			plane.scaleX = 1;
			plane.scaleY = 1;
			
			var target:DisplayObject3D = new DisplayObject3D();
			target.copyTransform( plane );
			target.moveBackward( 350 );
	
			camera.extra.goPosition.copyPosition( target );
			camera.extra.goTarget.copyPosition( plane );
	
			plane.material.lineAlpha = 0;
		
			buttonName = plane.name;
			
			var url:String;
			
			switch(buttonName){
				
				//services page
				case "10": 
				setCurrentPage(10);
				requestPage(getCurrentPage(), "services.swf");
							
				break;
				
				//contact page
				case "4": 
				setCurrentPage(4);
				requestPage(getCurrentPage(), "contact.swf");
				break;
				
				//portfolio page
				case "8": 
				setCurrentPage(8);
				requestPage(getCurrentPage(), "portfolio.swf");
				break;
				
				//preview page
				case "6": 
				setCurrentPage(6);
				requestPage(getCurrentPage(), "preview.swf");
				break;
				
			}
			
		};
		
		private function requestPage(pageNum:Number, url:String):void{
			
			var req:URLRequest = new URLRequest(url);
			var pageLoader:Loader = new Loader();
			
			pageLoader.addEventListener(ProgressEvent.PROGRESS, preloader);
			pageLoader.addEventListener(Event.COMPLETE, loadPage);
			
			pageLoader.load(req);
			
		}
		
		private function loadPage(e:Event):void{
			container_mc.addChild(e.target.content);
			trace(e.target.content);
		}
		
		private function preloader(pe:ProgressEvent):void{
			var percentLoaded:Number = pe.bytesLoaded/e.bytesTotal;
    		percentLoaded = Math.round(percentLoaded * 100);
			trace(percentLoaded);
		}

In the output window I am getting what I expect (there is a document class for each SWF file being loaded that traces a message - contact loaded etc), but I am not seeing anything happen on within the flash movie, no percentLoaded being traced either. If I take:

pageLoader.load(req)

out of the equation, nothing loads at all as expected. I have a feeling my listeners are in the wrong place, can anyone shed any light on this?

Thanks in advance!

I’m still pretty new to as3, but I’m pretty sure you need to add your loader to the display list.

Bardic is right, at some point you need to do something like:


addChild(pageLoader);

… otherwise your content will load, but not be displayed.

Thanks for the responses guys! Just tried what you suggested and put that line in my requestPage() function, it works but I am still a little confused, I thought this line was adding it to my container movie:

private function loadPage(e:Event):void{
            container_mc.addChild(e.target.content);
            trace(e.target.content);
        } 

Could someone offer a brief explanation of what this is doing, if anything!

Thanks again!