1.xml文件数据样式:
<MyDataList>
<StateList>
<item><value>1</value><label>活动</label></item>
<item><value>2</value><label>掩藏</label></item>
<item><value>0</value><label>不活动</label></item>
</StateList>
</MyDataList>
2.转换代码:
var xmlList:XMLList = MyData.StateList.item;
var xmlListCollection:XMLListCollection=new XMLListCollection();
xmlListCollection.source=xmlList;
var statusArr:ArrayCollection = new ArrayCollection(xmlListCollection.toArray());
3. 取值:
var indexs:int = 0;
for (var n:int = 0; n < statusArr.length; n++)
{
if (statusArr[n].value == statusValue){
indexs=n;
break;
}else{
indexs=0;
}
}
分享到:
相关推荐
NULL 博文链接:https://xaajie.iteye.com/blog/379054
flex外部读取xml
NULL 博文链接:https://tangdonglai.iteye.com/blog/1478277
flex通过httpService读取xml数据到datagird中,通过读取远程URL的XML数据(这里保存到本地),保存到ArrayCollection中,然后在将ArrayCollection绑定到datagird上 环境:flex3.0 可直接运行
tree多数情况下操作xml比较方便,而本人却对xml有些排斥,说得更确切些,对xml用的不是那么得心应手,所以选择了ArrayCollection
<?xml version="1.0" encoding="utf-8"?> creationComplete="service.send()" > <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.collections.ArrayCollection; ...
使用Object对XML和ArrayCollection之间的转换,包括9种图形集合,简单样式及效果。物有所值,绝对可以运行。
最近研究FLEX,在网上看过100遍同一篇文章,结果测试不通,不知道到底能不能跑通,最后翻资料自己试验处理。
首先环境:Myeclipse+Flex4.5+FusionCharts 至于FusionCharts的相关文件稍后我将放在附件中。 1.新建flex工程: 2.对工程进行相应配置 3.继续配置: 4.找到fusioncharts文件中FusionChartsFlex\...
flex3的cookbook书籍完整版dpf(包含目录),目录是我花了两个多小时自己整理的,希望对大家有帮助。 目录: 第一章.Flex与ActionScript基础(3) 1.1节.用FlexBuilder创建Flex项目 1.2节.用FlexBuilder创建Flex库项目 ...
<?xml version="1.0" encoding="utf-8"?> *" creationComplete="initTree();... change="iFrame.source=tree.selectedNode.path" ... // TODO: add some links here to Flex sites } ]]> </mx:Application>