Early context initialization to let the bootstrap take place while preloader is visible

Chetan Sachdev's Avatar

Chetan Sachdev

24 May, 2013 09:52 AM

I am using robotlegs 1.5.2 with flex 4.6. I have created a preloader which extends SparkDownloadProgressBar. I want the preloader to be visible while some bootstraping of the application is taking place e.g. loading font, external initial data etc. To do this I override initCompleteHandler method of preloader, which stops dispatching of Event.COMPLETE (as soon as this gets fired, preloader will hide). After exploring the Context.as I find that it listen for onAddedToStage event. How can I get context to run the autostartup while preloader is still active ?

  1. Support Staff 1 Posted by creynders on 24 May, 2013 04:43 PM

    creynders's Avatar

    I don't get it. If you overrode the initCompleteHandler, isn't the preloader shown automatically while the context does the autostartup?

  2. 2 Posted by Chetan Sachdev on 26 May, 2013 08:42 AM

    Chetan Sachdev's Avatar

    No, the context doesn't autostartup. I have defined it in fx:Declarations section. Should I define it on some flex application event ?

  3. Support Staff 3 Posted by creynders on 26 May, 2013 05:48 PM

    creynders's Avatar

    Could you post the context initialization code? Normally it autostarts.

  4. 4 Posted by Chetan Sachdev on 27 May, 2013 08:37 AM

    Chetan Sachdev's Avatar

    In my main application, I have added:
    <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> <mvcs:ApplicationContext contextView="{this}"/> </fx:Declarations>

    and ApplicationContext looks like below:

    public class ApplicationContext extends Context
    { public function ApplicationContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true) { super(contextView, autoStartup); }

                override public function startup():void
            dispatchEvent(new InitConfigureEvent());
  5. Support Staff 5 Posted by creynders on 29 May, 2013 05:52 AM

    creynders's Avatar

    Hi, not sure whether it's the cause, but shouldn't it be

    dispatchEvent(new InitConfigureEvent(InitConfigureEvent.CONFIGURE));


  6. Support Staff 6 Posted by Ondina D.F. on 10 Jun, 2013 11:39 AM

    Ondina D.F.'s Avatar

    Hi Chetan,
    I'm assuming this is resolved. Feel free to reopen this discussion in case you have more questions or you need further assistance with this issue.

  7. Ondina D.F. closed this discussion on 10 Jun, 2013 11:39 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac