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

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

问题描述

 < root> 
< render>
< head>
< transition id =fadeIntype =fadesubtype =dur =3s/>
< transition id =fadeOuttype =fadesubtype =dur =3s/>
< layout>
< root-layout width =480pxheight =360pxbackgroundColor =0/>
< region id =rootRegiondur =15s>
< / region>
< / layout>
< / head>
< body>
< par region =backgroundbegin =0s>
< img>
< meta name =assetsourcecontent =stock/>
< src> http://s3.amazonaws.com/JivoxStockImage/000003296736.jpg< / src>
<宽度> 102.49999999999999%< /宽度>
< height> 97.5%< / height>
< / left> 0%< / left>
< top> 0%< / top>
< clipBegin />
< clipEnd />
<开始> 0< /开始>
< dur> 15< / dur>
< / img>
<音频>
< meta name =assetsourcecontent =stock/>
< src> http://audio.mp3< / src>
< clipBegin />
< clipEnd />
<开始> 0< /开始>
< dur> 15s< / dur>
< / audio>
< / par>
< par region =foregroundbegin =0s>
< img>
< meta name =assettypecontent =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>



< / form>
< / root>

这里我需要将'form'中的formId与'render'中的'id'在flex中动态创建表单。



我可以通过httpservice获取xml文件。所有我需要知道的是如何匹配它并动态地呈现表单!

解决方案

如果我没有错,您需要它与表单ID相匹配,该表单ID又是动态的,表单中将包含基于ID的元素。



我的问题:


  1. 为什么不创建整个表单而不使用任何ID来匹配。您可以通过解析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>

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

解决方案

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.

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

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