How do you create a Preloader with ActionScript 3 in Flash CS3?
Ok, I’ve searched with Google, I’ve asked on FlashCoders but nowhere got an answer. As far as I can understand it we still have to deal with the old problem in Flash of exporting library assets into frame 1 and using a Preloader. If we simply export the library stuff (and classes) into frame 1 we render our Preloader pretty much useless. But creating a Preloader like in ActionScript 2 obviously doesn’t work anymore.
[ad#ad_content]Usually I’m using a setup like this when creating something in the Flash IDE … my main timeline has three frames, the first only contains the preloader, the second contains a Movieclip that keeps all the linked stuff from the Library and all Classes and the third is where my app starts. Pretty easy, pretty clear.
In ActionScript 3 the MovieClip doesn’t have bytesLoaded and bytesTotal properties anymore but it has a loaderInfo property over which these values can be accessed. If we use these commands in frame 1 but export all our classes in frame 2 (or beyond) we have a problem: The classes required by the Preloader are not there when needed.
A chicken before the egg problem. The classes are in frame 2 but some of them are already needed in frame 1 and if we export all classes into frame 1 we render our Preloader unable to display it’s preload bar early enough at least if we use a lot of classes in our application and unfortunately we cannot put only specific classes into frame 1.
There’s an AS3 tutorial here but it doesn’t mention anything about exporting classes into frame 2.
So how do you do it? Did I miss something in the docs or is the solution so banally obvious but I cannot see it? Or am I totally wrong with my approach and it’s done in a completely different way now? It would be cool to hear some thoughts about this.