Rendering form on the fly from XML in flex

不羁的心 提交于 2019-12-25 02:16:09

问题


I have an xml code something like this

<root>
<render>
 <head>
<transition id="fadeIn" type="fade" subtype="" dur="3s"/>
<transition id="fadeOut" type="fade" subtype="" dur="3s"/>
<layout>
  <root-layout width="480px" height="360px" backgroundColor="0"/>
  <region id="rootRegion" dur="15s">
    <region id="background" soundLevel="100%" top="0px" left="0px"   width="480px"          height="360px" z-index="0"/>
    <region id="foreground" soundLevel="100%" top="0%" left="0%" width="480px" height="360px" z-index="1"/>
  </region>
</layout>
</head>
<body>
<par region="background" begin="0s">
  <img>
    <meta name="assetsource" content="stock"/>
    <src>http://s3.amazonaws.com/JivoxStockImage/000003296736.jpg</src>
    <width>102.49999999999999%</width>
    <height>97.5%</height>
    <left>0%</left>
    <top>0%</top>
    <clipBegin/>
    <clipEnd/>
    <begin>0s</begin>
    <dur>15</dur>
  </img>
  <audio>
    <meta name="assetsource" content="stock"/>
    <src>http://audio.mp3</src>
    <clipBegin/>
    <clipEnd/>
    <begin>0s</begin>
    <dur>15s</dur>
  </audio>
</par>
<par region="foreground" begin="0s">
  <img>
    <meta name="assettype" content="user"/>
    <src>http://image.png</src>
    <width>20%</width>
    <height>20%</height>
    <left>41.5%</left>
    <top>25.555555555555557%</top>
    <begin>2s</begin>
    <dur>10s</dur>
    <id>BA6B7CF0BD9080CAD7A02199483224EA61A6E08A</id>
  </img>
  </par>
  </body>
 </render>

<form>

<map formId="BA6B7CF0BD9080CAD7A02199483224EA61A6E08A" type="image" label="Logo" />  
<map formId="F635A9123082A15834389030382683C55EB29E75" type="text" label="Company Name" />


</form>
</root>

Here I need to match formId in 'form' with that of 'id' in 'render' and create the form dynamically in flex.

I am able to get the xml file via the httpservice. All I need to know is how to match it and render the form dynamically!!


回答1:


If i am not wrong, you have the ID's and you need it to match with form ID's which is again dynamic and form will have elements based on the ID's.

My Questions:

  1. Why don't you create the entire form without using any ID's to match. You can directly create the entire form with elements by parsing an XML file.

Let me know if you are looking at this solution or something else, before i spend more wee on this.



来源:https://stackoverflow.com/questions/628841/rendering-form-on-the-fly-from-xml-in-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!