【发布时间】:2014-02-16 22:08:26
【问题描述】:
我正在尝试过滤 xml 数据,但现在我没有数据出现在列表中。我做错了什么吗?对不起,伙计们,我也是这个网站的新手。请原谅我,如果我张贴错误的方式。
这是错误。
TypeError:错误 #1034:类型强制失败:无法将 mx.collections::ArrayCollection@51443c1 转换为 XMLList。
xmlns:s="library://ns.adobe.com/flex/spark" title="Malls"
creationComplete="malls.send()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:HTTPService id="malls" url="assets/details.xml"
result="malls_resultHandler(event)"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var ml:XMLListCollection;
private function malls_resultHandler(Event:ResultEvent):void
{
ml = new XMLListCollection(malls.lastResult.list.mallD);
}
private function filterDemo():void{
ml.filterFunction=searchDemo;
ml.refresh();
}
private function searchDemo(item:Object):Boolean{
var isMatch:Boolean=false;
if(item.name.toLowerCase().search(search.text.toLowerCase())!=-1){
isMatch=true;
}
return isMatch;
}
]]>
</fx:Script>
<s:navigationContent/>
<s:titleContent>
<s:TextInput id="search" change="filterDemo()" x="10" y="10" prompt="Search"/>
</s:titleContent>
<s:List id="list" top="0" bottom="0" left="0" right="0"
dataProvider="{ml}"
change="navigator.pushView(MallsDetails, list.selectedItem)">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer
label="{data.name}"/>
</fx:Component>
</s:itemRenderer>
</s:List>
【问题讨论】:
-
也显示您的 XML 结构
-
1 Ion Orchard 2 Orchard TurnSingapore 238801 +65 6238 8228 customercare@ionorchard.com.sg Ion.png -
1.哦..在您的问题中实际发布您的 XML 会很好。 2. 如果你已经有 XML 为什么不使用 XML 的东西而不是数组集合。请更新您的帖子以获得更好的知名度。
标签: xml apache-flex flash-builder flex4.5 flexbuilder