1 Reply Latest reply on Jan 27, 2010 7:35 AM by Gregory Lafrance

    Using the vanilla/default preloader to load additional assets?


      I have a Flex application that automatically loads the SWF and it's contents and displays the default progress bar like in all Flex apps. Currently I have a class in the application using a Loader instance to load a few external bitmaps to be added to the stage/canvas as well as an MP3. I'd like to handle the loading of these assets in the Flex default preloader and get rid of the Loader instance entirely.


      How can I do this?

        • 1. Re: Using the vanilla/default preloader to load additional assets?
          Gregory Lafrance Level 6

          At least for the images, and perhaps for the sound, you need to not use loader, and instead embed the assets, because if loader is used the assets load at the same time as the SWF, which is too late.


          So in the createChildren method you override when you override DownloadProgressBar:


          //global var

          [Bindable] public var logoCls:Class;

          private var logoDO:DisplayObject;

          // in createChildren() method

          logoDO = new logoCls();
          logoDO.x = (stageWidth/2)-(borderRect.width/2)+_logoX;
          logoDO.y = (stageHeight/2)-(borderRect.height/2)+_logoY;


          If this post answers your question or helps, please mark it as such.

          Greg Lafrance - Flex 2 and 3 ACE certified


          Flex / AIR Development, Training, and Support Services