Search code examples
actionscript-3flashflash-builderpreloaderswc

FlashBuilder: how to embed graphics for preloader?


I develop a project in FlashBuilder. The graphics and UI elements i create in the Flash IDE and give them Export Classnames. then I put the SWC in the library paths of the FlashBuilder project and create the UI elements by instanciation.

Now I want to add a Preloader for the application. I follow this article, which works:

http://pixelpaton.com/?p=4642

My question is now: I also need some graphics for the preloader. But how do I ensure that the graphics for the preloader will be loaded first, such that the preloader class can start as soon as possible?


Solution

  • The compiler will figure out the dependencies for your preloader class, and load them first.

    For example:

    public function Preloader()
    {
        addChild(new UIElementFromFlash());
    }
    

    Flash Builder will know UIElementFromFlash needs to be loaded before Preloader. It will also load Preloader before your main class and its dependencies as long as you have the Frame metadata tag from the article.