# AS3 load external swf file

**URL:** <https://forum.kirupa.com/t/as3-load-external-swf-file/270442>\
**Category:** flash\
**Created:** [September 9, 2008, 11:59pm UTC](https://forum.kirupa.com/t/as3-load-external-swf-file/270442 "2008-09-09T23:59:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RJkey](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@RJkey](https://forum.kirupa.com/u/RJkey)\
**Post date:** [September 9, 2008, 11:59pm UTC](https://forum.kirupa.com/t/as3-load-external-swf-file/270442/1 "2008-09-09T23:59:36Z")

</div>

Hi,

I tried to load a swf file stored at the same path as my current load file I try to load an external swf file that is stored at the same path as my current Main.fla. I got some strange error like: TypeError: Error #1009: Cannot access a property or method of a null object reference.at mini$iinit()

Since I don’t have any function called init in the AS class for the external swf, I just don’t know where to start for debugging. Does anyone know what might cause this problem?

The file “mini1.swf” runs fine as a standalone.

Here is my code in my Main.fla:

import [flash.net](http://flash.net).\*  
import flash.display.Loader;

var temp;  
var loader:Loader = new Loader();

temp = new URLRequest(“mini1.swf”);  
loader.load(temp);  
addChild(loader);

Thanks a lot for any hints.
