Sorry about the title, I’m not exactly sure how to explain this with a few words.
I’ve looked through google searches and found that people find it easlier when exporting classes in frame 2 when using a preloader. I’m currently using the usual method of having frame 1 with the preloader, frame 2 with the asset holder and the bulk of the game, frame 3 has the stop(); action. This is the tutorial I followed to get a working preloader AS Gamer.
After many hours of searching I’ve only found mentions and revalations of people using export on frame 2 instead of the traditional asset holder, but no examples or tutorials.
Does any know where I can find a tutorial with example code I reference to get a export on frame 2 preloader?
I’ve been meaning to write a complete tutorial on the subject of preloaders, but I’m still in the middle of getting my new site launched… until then, here are the hightlights:
Two parts are going to be required –
one on the javascript side: sending flashvars into the preloader, and embedding the flash object into the html structure. I love swfobject for its simplicity and its bulletproofness.
html:
logic.js:
On the flash side, we have the preloader fla (or however you’re building it). Its purposefully “content-agnostic” because I reuse it for all my preloading. You could save some time by hardcoding in the flash vars, i spose. Anyway, I’ve got two classes –
Main.as – which pulls in the flashvars at runtime, initiates the load, and then responds to the loading progress, finally adding the loaded content into the display list.
Preloader.as – which does all the heavy lifting.
Note these are partial classes pulled directly from my project, and I’ve included only the bare essentials (you’ll have to finish out the code and tailor as needed).
Note also that this is one of many ways to do this 😉
Main.as :
Preloader.as
Hopefully that helps get you started. Let me know if you have any questions.
cheers!