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;
}
}