1 Reply Latest reply on Jan 29, 2008 2:38 PM by Jason Szeto

    Dynamic UI creation during runtime

    DominicV Level 1
      Can anyone help? What I would like to be able to do is have a flex 3 application that includes a designer for users to add content in a publishing fashion; for example this is a representation of what would be generated via the designer:
      <mx:VBox backgroundColor="#FFFFFF">
      <mx:Canvas width="200" height="200">
      <mx:Text x="10" y="10" text="This is example content."/>
      </mx:Canvas>
      <mx:Canvas width="200" height="200">
      </mx:Canvas>
      </mx:VBox>

      this "page" content would then get saved to a database and can be retrieved later from the database and viewed by other people.

      Does anyone have any ideas on how to save the Flex objects to the database, and when retrieved recreate the objects in the Flex application? My aim is to provide users with something like the scrapblog.com designer but to create content such as a WIKI page.

      Thanks,

      Dominic.
        • 1. Re: Dynamic UI creation during runtime
          Jason Szeto Level 3
          Dominic,

          Unfortunately we do not currently have support for runtime MXML (ie. taking a snippet of MXML and rendering it). MXML is currently a compiled language only.

          Here are a couple of thoughts:

          - You can either find or write an MXML parser. A parser reads in the MXML and then dynamically generates and attaches the display objects at runtime.

          - You can wrap each snippet of code in a module, compile it and then store that swf. Then your application can access the DB and load in this module. This might be a little heavy if you have lots of code snippets.

          - You can define your own subset of objects that you can use (ex. Buttons, TextInputs, Containers) and then write those out in XML. You can then load in the XML and dynamically recreate those objects. (This is probably what scrapblog does).