# Loading swf problem

**URL:** https://forum.kirupa.com/t/loading-swf-problem/273668
**Category:** Uncategorized
**Created:** [October 18, 2008, 4:50pm UTC](https://forum.kirupa.com/t/loading-swf-problem/273668 "2008-10-18T16:50:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rahul\_7star](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@rahul\_7star](https://forum.kirupa.com/u/rahul_7star)
#### Post date: [October 18, 2008, 4:50pm UTC](https://forum.kirupa.com/t/loading-swf-problem/273668/1 "2008-10-18T16:50:30Z")

</div>

HI well this is the code to load swf…

stage.scaleMode = flash.display.StageScaleMode.NO\_SCALE;  
stage.align = flash.display.StageAlign.TOP\_LEFT;

var urlToLoad:String = “demo.swf”  
//path to SWF that i want to load

var swfLoader:Loader = new Loader();  
//you have to make a new loader variable to load the SWF

var swfRequest:URLRequest = new URLRequest(urlToLoad);  
//you have to make a new URLRequest to put a URL to load from

swfLoader.load(swfRequest);  
//using the .load method will actually load the URL into the loader

addChild(swfLoader)  
////////////////////////////////// end  
this code load swf…but when i tried with 1 swf… i got the error

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at Main$iinit()

how to sove this error…its important for me to load this swf…desired swf is working perferctly when running independently
