2 Replies Latest reply on Dec 24, 2008 9:34 PM by WestSide

    Dynamic MXML?

    WestSide Level 1
      Hi,

      I have the need to display a different form <mx:Form /> based on a selection in a flex tree control. I have 10 forms in total, each completely different.

      The code is mxml, not actionscript so I am unsure how to do the if/else logic to change the form to the appropriate one as the user picks selections from the tree.

      This should be easy to do, I know what I want, just not sure how to achieve it.

      I have attached one of the forms. So I need a way of dynmcially creating this MXML. As you see, the form elements are hard coded, I want a way to dynamically show different form elements within a form based on a selection from the tree.

      how can this be done? ViewStack with each form as a child?

      -Westside
        • 1. Re: Dynamic MXML?
          Level 7

          "WestSide" <webforumsuser@macromedia.com> wrote in message
          news:gisa85$qpv$1@forums.macromedia.com...
          > Hi,
          >
          > I have the need to display a different form <mx:Form /> based on a
          > selection
          > in a flex tree control. I have 10 forms in total, each completely
          > different.
          >
          > The code is mxml, not actionscript so I am unsure how to do the if/else
          > logic
          > to change the form to the appropriate one as the user picks selections
          > from the
          > tree.
          >
          > This should be easy to do, I know what I want, just not sure how to
          > achieve it.

          Just put them in a ViewStack and switch to the correct "pane" based on your
          logic. I'd use switch/case rather than if-then, but that's just a matter of
          style. Both will work.

          HTH;

          Amy


          • 2. Re: Dynamic MXML?
            WestSide Level 1
            Roger that..... that's what I ended up doing... switch/case is definitely faster than the if/else....

            Thanks,

            -Westside