2 Replies Latest reply on May 5, 2010 5:41 PM by kamckng

    help with preloader

    kamckng Level 1

      Hey everyone,


      I'm a veteran with AS3 but new to flex.


      I'm trying to preload some stuff and actually have a preloader setup using the preloader attribute of my main mxml file. The problem is that after the preloader runs and does it's thing, the movie moves on to frame two where i start loading external things from a DB. And I have to use another preloader to show that. I'd rather use one preloader that shows the loading of the main swf, and then also shows the loading of my external assets. Sorry if it's not explained well, like I said I'm pretty new to flex. So is there some way that anyone knows of that I can accomplish this?



        • 1. Re: help with preloader



          There's some discussion about this subject on this page:  http://npacemo.com/wordpress/2008/07/06/flex-application-bootstrapping-totally-custom-prel oader/


          You might run into the same problem I am though, and that's how to start using Flex classes in the preloader.  Is there a way to detect when the Flex framework has loaded so that we can safely use these classes?  I'm trying to do something similar to OP, where my preloader access a data service before letting the application start, and I want to use classes in the mx.rpc package, but am not sure how.




          • 2. Re: help with preloader
            kamckng Level 1

            I did find a "solution" to my particular problem. In my custom Preloader.as class I created a static variable that is set to the instance of the preloader in it's constructor. Then I don't dispatch the Event.COMPLETE event in it's normal place. Instead it loads the swf normally and then my application takes over and I load all assets I need in there, and I use Preloader.instance and pass in how far along I am. So then the preloader instance still exists and once my app is done, I send that it's done to the preloader and THEN I dispatch the Event.COMPLETE.