3 Replies Latest reply on Aug 25, 2006 10:54 AM by ntsiii

    parse mxml

      Hi, I'm new to flex and I'm wondering if it's possible to pass mxml as a string into flex and "eval" it and have flash execute the code.
        • 1. Re: parse mxml
          ntsiii Level 3
          No, sorry, you can't do that. the Flash Player does not know anything about mxml.

          Maybe we can help figure out something else?

          • 2. Re: parse mxml
            lpenaflor Level 1
            Thanks for the quick response.

            Well what I'm trying to do is dynamically generate form items on the screen from the database. I wrote a framework-ish for this in ActionScript and we're wondering how we can do this with flex. If the flash player knows nothing about mxml, so it must all be in the compiler.

            Could I send an XML schema to the Form element to generate form items then?

            Thanks and I look forward to your reply.
            • 3. Re: parse mxml
              ntsiii Level 3
              First, the simplest thing to look at is a Repeater. Its entire purpose is to repeat a component or set of components based on data.

              If a Repeater is not flexible enough, and you want to be able to, say dynamically remove or add specific components ar run time based on changing data, you can use the addChild() removeChild() methods of Containers and States.

              Finally, you can use the new keyword to instantiate any component pretty much anywhere.

              By the way, don't get to hung up on the Form container at the expense of considering HBox, VBox and Canvas. The Form container can be restrictive when you get particular about your layout.