2 Replies Latest reply on Jul 29, 2011 10:23 PM by CleanCoder

    view states


      I have a set of groups with sub-groups and labels. I'm trying to hide/show the labels with view states....



           <s:State name="first" />
           <s:State name="second" />
      <s:Group id="group1">
           <s:Group id="subGroup1" includeIn="first">
                <s:Label id="g1_sg1_lbl1" text="subGroup1 first text 1" />
                <s:Label id="g1_sg1_lbl2" text="subGroup1 first text 2" />
           <s:Group id="subGroup2" includeIn="first">
                <s:Label id="g1_sg2_lbl1" text="subGroup1 first text 1" />
                <s:Label id="g1_sg2_lbl2" text="subGroup1 first text 2" />
      <s:Group id="group2">
           <s:Group id="subGroup3" includeIn="first">
                <s:Label id="g2_sg3_lbl1" text="subGroup1 first text 1" />
                <s:Label id="g2_sg3_lbl2" text="subGroup1 first text 2" />
           <s:Group id="subGroup4" includeIn="first">
                <s:Label id="g2_sg4_lbl1" text="subGroup1 first text 1" />
                <s:Label id="g2_sg4_lbl2" text="subGroup1 first text 2" />


      Everything behaves properly in FB. Problem is, at runtime, when I set the currentState = "first", it only shows subGroup1 and not subGroup3.


      Thanks in advance for any help!

        • 1. Re: view states
          togawearer Level 1

          Flex just makes me "hate everything" sometimes. I changed my subgroups from "s:Group" to "s:VGroup" and everything works. Probably a Flex bug here somewhere, but maybe the post will help the next poor sap that runs into this problem.

          • 2. Re: view states
            CleanCoder Level 2

            I believe you could have achieved the same result by assigning a VerticalLayout to the group's layout property. Your subGroups were all positioned at (0, 0) so you could only see one at a time, the VGroup just spaced them out.