# Preloading External Classes (Willing to Pay $$)

**URL:** <https://forum.kirupa.com/t/preloading-external-classes-willing-to-pay/287409>\
**Category:** flash\
**Created:** [April 30, 2009, 5:06pm UTC](https://forum.kirupa.com/t/preloading-external-classes-willing-to-pay/287409 "2009-04-30T17:06:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoyle\_billy](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@hoyle\_billy](https://forum.kirupa.com/u/hoyle_billy)\
**Post date:** [April 30, 2009, 5:06pm UTC](https://forum.kirupa.com/t/preloading-external-classes-willing-to-pay/287409/1 "2009-04-30T17:06:11Z")

</div>

Hello, I’m having problems preloading my Man.swf file.

My Preloader.swf consists of this simple code:

var l:Loader = new Loader();  
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);  
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);  
l.load(new URLRequest(“ **Main.swf** ”));  
function loop(e:ProgressEvent):void  
{  
var perc:Number = e.bytesLoaded / e.bytesTotal;  
percent.text = Math.ceil(perc\*100).toString();  
}  
function done(e:Event):void  
{  
removeChildAt(0);  
percent = null;  
addChild(l);  
}

The problem has something to do with the fact that my **Main.swf** refrences a few **external classes(ScrollBar.as, ScrollBox.as)** that control some scrolling functionality.

When I run the **Main.swf** on its own, everything works pefectly. When I try to load the movie by launching the **Preloader.swf** file I get the following errors:

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at ScrollBar$iinit()  
at flash.display::Sprite/flash.display:Sprite::constructChildren()  
at flash.display::Sprite$iinit()  
at flash.display::MovieClip$iinit()  
at ScrollBox$iinit()  
at flash.display::Sprite/flash.display:Sprite::constructChildren()  
at flash.display::Sprite$iinit()  
at flash.display::MovieClip$iinit()  
at Main$iinit()  
TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at ScrollBox$iinit()  
at flash.display::Sprite/flash.display:Sprite::constructChildren()  
at flash.display::Sprite$iinit()  
at flash.display::MovieClip$iinit()  
at Main$iinit()

Please help!
