3 Replies Latest reply on Jun 13, 2010 3:08 AM by FM_Flame

    Flex 4 ViewStack and Deferred Component Instantiation

    FM_Flame Level 1

      Here is a simple example of what I have:



      id="viewS" x="69" y="210" width="598" height="356">


           <s:NavigatorContent id="view1" label="View 1" width="100%" height="100%">


                <s:Button id="btn1" x="20" y="28" label="Button" />




           <s:NavigatorContent id="view2" label="View 2" width="100%" height="100%">


                <s:Button id="btn2" x="90" y="46" label="Button"/>






      Now, the default behavior or the viewstack is that it will automatically create the components in the current view and will defer all the rest, which is good for start up performance and is bad for the little gaps in showing the components when the user navigates and for the being not able to access the components that have not yet been created. The other way to go is set the creationPolicy="all" of the viewstack and it will take more time to create them but then all will be accessible with no delay in showing when the user navigates.


      So I was thinking of a different approach, which I would like to ask the more experienced guys here using this components for ages if it is possible.

      What I want to do is kinda combine the both ways. I want the viewstack to automatically create the first view and when that happens an event to shoot that it has been created. Then I want the event to call a function where I can specify all or for example view 3 and 5 to create everything they've got too. This way the user would have no delay when navigating in these views and will also have a fast start up. And I will be able to access all the components I need.


      To summarize: How do I manually create the compolnents in specific or all views of the viewstack?