作者yugiohx (我就是醬!)
看板Flash
標題[問題] 資料篩選
時間Tue Aug 12 16:03:11 2008
想問一下關於XMLListCollection裡資料篩選的部分要怎麼寫
因為想把道具欄分成好幾欄所以想在讀取XML時就分好
<mx:HTTPService id="src" url="game/item/item.xml" resultFormat="e4x"/>
<mx:XMLListCollection id="all" source="{src.item}"/>
<mx:XMLListCollection id="item" source="{src.items.(@type ==
'item').item}"/>
<mx:XMLListCollection id="equipment" source="{src.items.(@type ==
'equipment').item}"/>
<mx:XMLListCollection id="treasure" source="{src.items.(@type ==
'treasure').item}"/>
XML內容格式
<?xml version="1.0"?>
<itemss>
<items type="item">
<item num="1" name="珍珠奶茶" des="藏有蟑螂的奶茶" effect="" effecttype=""
value="" price="0" pic="@Embed(source='mrt_game/item/pic/1.jpg')"/>
</items>
因為我是照這個網頁的方式來寫
http://blog.minidx.com/2008/07/12/1065.html
卻一直出現錯誤= =
1119: 存取可能未定義的屬性 items (透過靜態類型 mx.rpc.http.mxml:HTTPService 的
參考)。
不知到哪裡寫錯了Q.Q
情各位大大幫我看一下~感恩
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.205.239
推 dreamboxer:離個題...你的XML設計的不是很好...@@ 我懷疑應該連你 08/12 17:28
→ dreamboxer:自己都搞不大清楚你的 item 是指哪個 item 吧...XD 08/12 17:28
→ yugiohx:會嗎?道具編號.名字.敘述.效果.效果種類.效果數值.價格. 08/13 00:05
→ yugiohx:最後是圖,就照這樣邊排阿,然後類別在一開始用屬性分類 08/13 00:06