1 Reply Latest reply on Nov 23, 2009 11:27 AM by msakrejda

    Dynamic view creation in Flex


      I am new to  Flex web applications and I am doing research to see if functionality

      contained in an existing web application can be replicated in a Flex web app.


      We currently have a JSP / Struts based web application that creates a data entry
      web view dynamically based on information that describes the different widgets and
      their view locations as recieved from the application backend.  We are looking at

      migrating this application and this functionality to Flex.


      When User X selects 1 of any number of data entry views, the Flex application would
      receive data from the back end that  contains information describing the different widgets

      to display on the dynamic view: what type of widget to display ( text field,combo, line,

      box, etc), the pixel specific positional information as to where each widget exists in the

      view.  These data entry views are not something the Flex developer designs or knows

      what to expect from the backend. Flex has to generate the view on the fly based on the

      information that describes the view.



      The question:  I fully expect there to be coding within the action scripts; before trying to
                           learn how to do this, is this something that Flex support.  





        • 1. Re: Dynamic view creation in Flex
          msakrejda Level 4

          Yep, we do something similar. We had to build out the infrastructure, but It works fine. E.g.,

          var bDesc:XML = <button x="10" y="5" label="hello world" color="red"/>

          var b:Button = new Button();

          b.label = bDesc.@label;

          b.x = bDesc.@x;

          b.y = bDesc.@y;

          b.setStyle('color', b.@color);



          In your app, the actual description (XML or other format) would be coming from the server. Then you just add it to the display list (and wire in any event handlers if necessary). In a real setting, you'll need error checking and a more formalized way of doing this, but it works reasonably well. No major snags.