External Preloader Library Linkage issue

Hey Everyone,

So I recently ran into a real frustrating problem when I was trying to make an external preloader for my swf, and I thought that I would share it here so that someone else won’t have to go through what I did.

Anyway, my original goal was to make a simple external preloader swf with nothing in its library, that would load my main swf that had all the resources in its library. After I got it all coded, I kept getting a reference error at runtime when I tried to run the preloader.swf file saying that variable such and such is not defined. The variable that it referred to was in fact, defined in the library of main.swf.

Main.swf would run fine on its own, and preloader.swf could load other swf’s fine if I just substitued the name. So I was really at a loss as to what was causing the problem. But after banging my head against the wall for several hours, I finally found the answer.

What I had done when I did the preloader was I just made the preloader.fla and the preloader.as file and put them both in the same directory with all the source code for my main swf. The problem with this was that when I compiled the preloader it must have got “confused” and tried to link in some of the classes (.as files) that I had in there for my main.swf. Then when I ran the preloader it thought that several variables in the main.swf were not defined.

So the solution to this issue was just to move the preloader.fla and the preloader.as into its own directory with just the main.swf (no source code for main). I compiled the preloader in there and it worked fine!

So the moral of the story is…if you are doing an external preloader make sure you keep it in its own directory when you develop it, or you can run into linkage type issues.