# Loader loading swf not working!

**URL:** <https://forum.kirupa.com/t/loader-loading-swf-not-working/318355>\
**Category:** flash\
**Created:** [January 18, 2011, 3:09am UTC](https://forum.kirupa.com/t/loader-loading-swf-not-working/318355 "2011-01-18T03:09:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VeddyCent](https://avatars.discourse-cdn.com/v4/letter/v/bc8723/32.png) [@VeddyCent](https://forum.kirupa.com/u/VeddyCent)\
**Post date:** [January 18, 2011, 3:09am UTC](https://forum.kirupa.com/t/loader-loading-swf-not-working/318355/1 "2011-01-18T03:09:20Z")

</div>

Hi all,

I’m having trouble with a simple loader not loading an external swf file.

I have a set of menu buttons (created from a class) that store the swf file name. When these are clicked they run a function that supposed to load the swf file but for some reason it doesn’t (but maybe it does load it, just not display it). So here’s the code:

```auto
var urlLoader:Loader = new Loader();

var pageHolder:Sprite = new Sprite();
pageHolder.height = 420;
pageHolder.height = 950;
pageHolder.x = -476;
pageHolder.y = 190;
addChild(pageHolder);

//3D Button
var btn3D:MenuButton = new MenuButton(" 3D", menuFont, menuFontSize, menuFontColour, "3DXML.xml", "Untitled-1.swf", true, false);
containerMenu.addChild(btn3D); //Adds button to container

btn3D.addEventListener(MouseEvent.CLICK, clickMainBtn);

function clickMainBtn(event:Event):void{
	var urlRequest:URLRequest = new 		
	URLRequest(event.currentTarget.getPageName);

	pageHolder.addChild(preloader);
	preloader.x = 0;
	preloader.y = 100;
	
	urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,pageLoaded);
	urlLoader.load(urlRequest);	

	pageHolder.addChild(urlLoader);		
	trace("loading page");
}

function pageLoaded(event:Event):void{
	pageHolder.removeChild(preloader);
	trace("page loaded");
}

```

The “page loaded” trace is being displayed, so must load the swf but not show it.  
I can’t even see the preloader.  
I also tried a very simple swf file with just some shapes and 1 frame but still no luck.

Are there any specific class I need to import?

Any help would be much appreciated  
Thanks in advance
