# \_preloader error

**URL:** https://forum.kirupa.com/t/-preloader-error/284977
**Category:** flash
**Created:** [March 25, 2009, 6:30pm UTC](https://forum.kirupa.com/t/-preloader-error/284977 "2009-03-25T18:30:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tical](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@Tical](https://forum.kirupa.com/u/Tical)
#### Post date: [March 25, 2009, 6:30pm UTC](https://forum.kirupa.com/t/-preloader-error/284977/1 "2009-03-25T18:30:12Z")

</div>

I’m getting an error from a file and its coming from my ‘loaderProgress’ function…everything actually loads in fine and it does what it is suppose to do so far, but after it loads everything in…it says: TypeError: Error #1009: Cannot access a property or method of a null object reference. at xml\_2\_fla::MainTimeline/loaderProgress()…

would anyone be able to tell me why i’m getting this error. Below is the code:

import flash.net.URLLoader;  
import flash.net.URLRequest;  
import flash.net.URLLoaderDataFormat;

var imgLoader:Loader;

function loaderProgress(eo:ProgressEvent):void {  
var perc:Number = eo.bytesLoaded / eo.bytesTotal;  
var percStrng:String = Math.ceil(perc \* 100).toString() + “%”;  
\_straightLoader.\_innerLdr.scaleX = perc;  
\_percent.text = percStrng;  
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, \_kill);  
}

var xml:XML;  
var xmlList:XMLList;  
var xmlLoader:URLLoader = new URLLoader();  
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);  
xmlLoader.load(new URLRequest(“data/images.xml”));

function xmlLoaded(e:Event):void {  
xml = XML(e.target.data);  
xmlList = xml.children();  
trace(xmlList.length());

```
for (var i:int = 0; i &lt; xmlList.length(); i++) {
    imgLoader = new Loader();
    imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loaderProgress);
    imgLoader.load(new URLRequest(xmlList*.attribute("thumb")));
    imgLoader.x = 25;
    imgLoader.y = i * 150 + 15;
    addChild(imgLoader);
}

```

}

function \_kill(e:Event):void {  
// cleaning up the stage and file  
//remove these from the stage after the load is complete  
removeChildAt(getChildIndex(\_percent));  
removeChildAt(getChildIndex(\_spinner));  
removeChildAt(getChildIndex(\_straightLoader));  
// make sure that there is not action left on any objects that you can’t see  
// i. e. here we had a looping movieClip, this will insure it still isn’t using memory  
// i think!  
\_spinner.gotoAndStop(1);  
\_straightLoader.gotoAndStop(1);  
// this just makes sure that they are equal to null and are ready for garbage collection  
\_spinner = null;  
\_percent = null;  
\_straightLoader = null;  
}
