2 Replies Latest reply on Jul 23, 2007 11:11 AM by ntsiii

    Replacing mx Elements

    BTRichardson
      Hello all,

      Does anyone know if it's possible to dynamically replace an mx element in an application? For example, say I have a divided box with a combo box in the top part, and depending on what the user selects either a text box or a data grid shows up in the bottom part. Is this possible?

      Thanks in advance! -- btr
        • 1. Re: Replacing mx Elements
          JKohn99 Level 1
          You can do it several ways. Declare both of your UI controls in mxml and make them visible/invisible and set the correct x/y position based on what the user does.

          You can also dynamically create the components at runtime and add or remove them using the container.addChild or container.removeChild methods.

          Beware of memory issues if you create new objects every time. It is best to create one list, one grid and then manipulate it.

          We happen to do both methods.
          • 2. Re: Replacing mx Elements
            ntsiii Level 3
            Also, look into "states" and ViewStack.
            Tracy