0 Replies Latest reply on Sep 25, 2009 2:52 PM by msakrejda

    Dynamically creating nested controls

    msakrejda Level 4

      We need to build some components based on dynamically-parsed definitions. I don't need to parse MXML at runtime, but, e.g., if I have something like

       

      <tabnavigator>

        <hbox>

          <label text="foo"/>

          <label text="bar"/>

        </hbox>

        <label text="baz"/>

        <label text="quux"/>

      </tabnavigator>

       

      I want to be able to parse it into the corresponding Flex objects and then add this tree of components to the display list. Can I just instantiate each component and then call addChild immediately to add its children, or is there some event I need to wait for here? Calling addChild immediately after instantiation seems to work, but I want to make sure I'm not shooting myself in the foot with this design.