2 Replies Latest reply on Oct 27, 2009 8:51 AM by alistair1977

    GUI elements not initialized

    alistair1977 Level 1

      I have an application that pulls in XML and using databinding displays the data items in GUI components.  This often fails when the bound GUI components are on tabs that have never been made active (ie never viewed).  It seems that these widgets are sometimes not initialised properly.  The only way round it is to activate the tabs, then re-load the XML.

       

      Is there a better solution than this?

       

      thnx

        • 1. Re: GUI elements not initialized
          matthew horn Level 3

          Well, there's an easy solution that is not recommended, and a little harder to implement solution that is recommended. I'll start with the easy one.

           

          1) Set creationPolicy="all" on your navigator container (the tabnav) and then trigger your XML bionding to take place after the tabnav is creationComplete. This causes all children of the tab nav (including tabs not yet visible) AND their children to be created. Normally, for navigator containers (containers with multiple built in views), the children on the tabs that are not yet visible are not created until the tabs are navigated to. The reason why this is not recommended is that it's very much against the "initialize only what's needed" memory model... and the startup time will be longer, too, as the user must wait for all children on all tabs to be instantiated.

           

          2) Defer the binding for not-yet-visible UI components until the tab they are on is visible.

           

          There's more info in here: http://livedocs.adobe.com/flex/3/html/layoutperformance_01.html

           

          hth,

          matt horn

          flex docs

          1 person found this helpful
          • 2. Re: GUI elements not initialized
            alistair1977 Level 1

            Thanks for the quick response, it makes a lot of sense.  I'll investigate the second option.