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.COMPLET E, 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!