6 Replies Latest reply on Jul 19, 2009 11:50 PM by platus2000

    loading data asynchronously BEFORE showing popups/other components

    platus2000

      I have a problem that's been bugging me for a long time.. It feels to me that I might be missing something very basic, but anyway, it's very important., so please bear with my explanation

       

      My application has several modules. There is a menu on top of the screen, when the user clicks a button I instantiate one of the modules and add it to a canvas ('dashboard') which occupies most of the screen size.

       

      Now, most of these modules (which are simple MXML components) naturally require some data from the server. Actually, their looks, size and layout of many of them often DEPENDS on that data.

       

      What I'm CURRENTLY doing, is assigning  a 'creationComplete' event handler to the module (usually a canvas, VBox etc), and in that handler I make a call to the server with an HTTPService etc, giving it a callback function, and when the result arrives I start changing UI stuff around (setting some components to be invisible/visible, resizing others, changing colors etc etc..)

       

      The problem, of course,  is that since the module is already visible, the user sees these changes as they're happening (it happens pretty  fast, but still).

       

      What I want to be able to do is set the width/height/visibility of the subcomponents IN ADVANCE, and only then let flex continue to create and show the module.

       

      Is there a standard way of doing this? (BESIDES setting everything to: visible=false and then after the server call back to visible=true...)

      If my problem isn't clear I can attach some example code.