# Why is this loader coming up null?

**URL:** <https://forum.kirupa.com/t/why-is-this-loader-coming-up-null/308328>\
**Category:** Uncategorized\
**Created:** [April 21, 2010, 4:39am UTC](https://forum.kirupa.com/t/why-is-this-loader-coming-up-null/308328 "2010-04-21T04:39:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgarsteck](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mgarsteck](https://forum.kirupa.com/u/mgarsteck)\
**Post date:** [April 21, 2010, 4:39am UTC](https://forum.kirupa.com/t/why-is-this-loader-coming-up-null/308328/1 "2010-04-21T04:39:41Z")

</div>

```auto

function process(e:Event):void {

	TweenLite.to(bkg, 1, {alpha: .3});

	TweenLite.to(gal0,1, {alpha:.3});
	TweenLite.to(gal1,1, {alpha:.3});
	TweenLite.to(gal2,1, {alpha:.3});
	TweenLite.to(gal3,1, {alpha:.3});
	TweenLite.to(gal4,1, {alpha:.3});

	addChild(thumbHolder);
	myXML = new XML(e.target.data);
	total = myXML.Gallery[galNum].Image.length();
	for (var i:int = 0; i < total; i++) {

		picLoc = myXML.Gallery[galNum].Image*.@picURL;
		var thumbLoc:String = myXML.Gallery[galNum].Image*.@thumb;

		var picLoader = new Loader();
		var thumbLoader = new Loader();

		thumbLoader.name = i;
		thumbLoader.x =(thumbLoader.width + 55) * i;

		thumbLoader.y = 500;
		thumbWidth = thumbLoader.x + 55;

		thumbLoader.name = i;

		thumbLoader.load(new URLRequest(thumbLoc));
		thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadThumbs);
		thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadThumbs2);

	}

}

function loadThumbs(event:ProgressEvent):void {
	
	var percent:Number = Math.round((event.bytesLoaded/event.bytesTotal) * 100 );
	trace(percent);

}

function loadThumbs2(event:Event):void {

// this right here is causing the problem. When I have it in the process //function, it works just fine.  
	thumbHolder.addChild(thumbLoader); 
	/*testArray.push(thumbLoader);
	thumbHolder.x = (stage.width - thumbWidth) / 2;
	thumbHolder.alpha = 0;
	TweenLite.to(thumbHolder, 3, {alpha: 1});

	//thumbHolder.addEventListener(MouseEvent.CLICK, gallerySet);
	thumbHolder.addEventListener(MouseEvent.MOUSE_OVER, gallerySet2);
	thumbHolder.addEventListener(MouseEvent.MOUSE_OUT, fade);

	picLoader.load(new URLRequest(picLoc));
	*/

}

```

Im getting an error saying that the loader is null that i am trying to add to the stage. I dont know why. all I am trying to do is make a preloader, and its causing more of a headache than its worth ☹ can anyone assist me in trying to figure this out.

All I want it to do is show the percentage of loaded. I have the event.complete listener there to go add the thumbnails once they are fully loaded.
