How do you create a Preloader with ActionScript 3 in Flash CS3?

Google Search Results

You arrived here after searching for the following phrases:

Click a phrase to jump to the first occurrence, or return to the search results.

Ok, I’ve searched with Google, IR17;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 doesnR17;t work anymore.

Usually IR17;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 doesnR17;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 itR17;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.
ThereR17;s an AS3 tutorial here but it doesnR17;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 itR17;s done in a completely different way now? It would be cool to hear some thoughts about this.

    • laura
    • June 20th, 2009
  1. Web / Graphics Designer

  2. This doesn’t always work…

    stop();

    this.loaderInfo.addEventListener(Event.COMPLETE, initApplication);
    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);

  1. No trackbacks yet.