# Loading external SWF problems (PaperVision)

**URL:** <https://forum.kirupa.com/t/loading-external-swf-problems-papervision/260442>\
**Category:** Uncategorized\
**Created:** [May 15, 2008, 5:10pm UTC](https://forum.kirupa.com/t/loading-external-swf-problems-papervision/260442 "2008-05-15T17:10:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebelsoul2005](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rebelsoul2005](https://forum.kirupa.com/u/rebelsoul2005)\
**Post date:** [May 15, 2008, 5:10pm UTC](https://forum.kirupa.com/t/loading-external-swf-problems-papervision/260442/1 "2008-05-15T17:10:01Z")

</div>

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:

```auto
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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![bardic](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bardic/32/3708_2.png) [@bardic](https://forum.kirupa.com/u/bardic)\
**Post date:** [May 15, 2008, 5:42pm UTC](https://forum.kirupa.com/t/loading-external-swf-problems-papervision/260442/2 "2008-05-15T17:42:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [May 15, 2008, 6:15pm UTC](https://forum.kirupa.com/t/loading-external-swf-problems-papervision/260442/3 "2008-05-15T18:15:59Z")

</div>

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

```auto

addChild(pageLoader);

```

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

---

<div class="post-metadata">

**Author:** ![rebelsoul2005](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rebelsoul2005](https://forum.kirupa.com/u/rebelsoul2005)\
**Post date:** [May 16, 2008, 8:18am UTC](https://forum.kirupa.com/t/loading-external-swf-problems-papervision/260442/4 "2008-05-16T08:18:43Z")

</div>

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:

```auto
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!
