在 flex 中从 XML 动态渲染表单 [英] Rendering form on the fly from XML in flex

查看:25
本文介绍了在 flex 中从 XML 动态渲染表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似这样的 xml 代码

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>

这里我需要将 'form' 中的 formId 与 'render' 中的 'id' 匹配,并在 flex 中动态创建表单.

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

我可以通过 httpservice 获取 xml 文件.我只需要知道如何匹配它并动态呈现表单!!

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!!

推荐答案

如果我没记错的话,你有 ID,你需要它与表单 ID 匹配,表单 ID 也是动态的,表单将包含基于 ID 的元素.

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.

我的问题:

  1. 为什么不创建整个表单而不使用任何 ID 进行匹配.您可以通过解析 XML 文件直接创建包含元素的整个表单.

让我知道您是否正在查看此解决方案或其他内容,然后我会花更多时间在此上.

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

这篇关于在 flex 中从 XML 动态渲染表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆