2 Replies Latest reply on Nov 8, 2010 5:13 AM by Hattaman

    Child's ViewStack problem

    Hattaman

      Hello.
      I have a problem with the component ViewStack tab, and various children. I read documentation that children are not created until they are selected. Unfortunately I need to create all the children of ViewStack soon as the page loads, but by default the first showing.
      As far as I understand there is no a method to force the creation of total children (or am I wrong?), So I decided to load all tabs
      when the application starts and then return to the first.
      Unfortunately it does not work. The second tab is created, but then comes back to me on the first and remains the second. The layout is this:

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init();">
             
                  protected function init():void
                  {
                      // With index
                      propertySheet.selectedChild = 1;     // Make the second tab and...
                      propertySheet.selectedChild = 0;    // ...after show the first tab, but not function
                     
                      // With id
                      /*propertySheet.selectedChild = second;
                      propertySheet.selectedChild = first;*/
                     
                  }
                  <mx:ViewStack y="31" left="10" id="viewstack" width="246" height="450">
                      <mx:Canvas label="First Tab" width="100%" height="100%" id="first">
                          <!-- All the code -->
                      </mx:Canvas>
                      <mx:Canvas label="Second Tab" width="100%" height="100%" id="second">
                          <!-- All the code -->
                      </mx:Canvas> 
                   </mx:ViewStack>
      </mx:Application>

       

      Can you tell me why? The problem occurs with both the indexes with the id.
      One last thing, I'm using Flex 3, Flex 4 case with something that addresses this problem?
      Sorry for my English but I'm Italian
      Thanks, bye.