Hi Everyone. I am newbie and I am pleading for help to get me through this project. A friend told me to come here said you all were the best. I haven’t really found and solution to the problem I am having because, to most programmers, the problem is very simple. Here is my problem. [URL=“http://www.aestyria.com/jmkozlow.zip”]Download my files[/URL
In frame 1 of MainLoader.swf (basically just a preloader) I have this code:
preloader_mc.stop();
preloader_mc.visible=false;
var swf:String='Main.swf';
var richiesta:URLRequest=new URLRequest(swf);
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.OPEN,openMC);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,working);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,done);
loader.load(richiesta);
function openMC(e:Event):void
{
preloader_mc.visible=true;
preloader_mc.play();
}
function working(e:ProgressEvent):void
{
var percentage:uint=(e.bytesLoaded/e.bytesTotal)*100;
preloader_mc.loader_txt.text='loading '+percentage.toString()+'%';
}
function done(e:Event):void
{
preloader_mc.stop();
preloader_mc.visible=false;
addChild(loader);
}
This used to load “Main.swf” but now that I have added a document class “Main.as” to control my main menu. I get an error when I launch “MainLoader.swf.”
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main/::init()
at Main$iinit()
Basically, how do I load a swf and it’s class into a preloader like this. I am open to any other suggestions or help to make this project more efficient. You can get the files here. Everything is bare bones.
Thanks!
jmkozlow