我有一個Arraycollection,其中包含其他數組。 我想與要顯示的項目裏面的數據呈現,但不能管理要做到這一點 這裏是示例代碼來說明我的問題如何在ITEMRENDER組中顯示ArrayCollection | ACTIONSCRIPT
<s:DataGroup dataProvider="{news}"
itemRenderer="components.displaynews">
,這是該項目呈現
<s:Label text="{data.??/}"/>
現在我不明白是什麼後數據?在數組集合中,數據如下所示:myArrayCollection - > [0] - >名字
所以當im綁定數據到物品渲染時,我該如何表示[x]以獲得我想要的特定名稱?這obviusly不會工作
<s:Label text="{data.[0].name/}"/>
還有一件事是什麼,是與簡單的項目清單\組,以顯示數據渲染(圖片和文字)
感謝您的幫助提前 10倍的最輕的方式!
private function convertFBEventData2TreeData(eventData:Object):Object
{
var children:ArrayCollection = new ArrayCollection();
var numAttrs:Number = 0;
for (var attrName:String in eventData)
{
var val:Object = eventData[attrName];
if (val != null)
children.addItem({label:attrName, children:convertFBEventData2TreeData(val)});
numAttrs++;
}
if (numAttrs == 0 && eventData != null)
{
children.addItem({label:eventData});
}
return children;
}
這是我的數據
eventData [] (@cb73bc9)
[0] Object (@a3f9461)
actions [] (@cb736f1)
application null
created_time "2011-07-29T11:46:31+0000"
from Object (@a49c179)
id "100002237793631_139378476146745"
message "2 And a half days on a 546 mile load just to find out they wont except the load,when we should b doin 1000 miles a day,somebody needs to get their shit together"
type "status"
updated_time "2011-07-29T11:46:31+0000"
[1] Object (@ca53239)
[2] Object (@d023a49)
[3] Object (@d029059)
[4] Object (@cb796e9)
[5] Object (@d023ce9)
[6] Object (@cb79809)
[7] Object (@a49c6e9)
[8] Object (@d0238c9)
[9] Object (@d029a19)
[10] Object (@ca53509)
[11] Object (@d0261a9)
[12] Object (@a5b5a91)
[13] Object (@cb79a61)
[14] Object (@d025761)
[15] Object (@d023b09)
[16] Object (@a49c521)
[17] Object (@d0258e1)
[18] Object (@d0232b1)
[19] Object (@cb80c11)
[20] Object (@cb3e4c1)
[21] Object (@a5b25f9)
[22] Object (@d074491)
[23] Object (@d02f9e9)
[24] Object (@d024b81)
length 25 [0x19]
有與項目渲染來顯示它的方式?我不能設法做
,我把它轉換上面的代碼的ArrayCollection,然後將數據是這樣的:
resultsData mx.collections.ArrayCollection (@918cec1)
[inherited]
[0] Object (@d023779)
[1] Object (@d024f29)
children mx.collections.ArrayCollection (@ca1bac1)
[inherited]
[0] Object (@d0247a9)
children mx.collections.ArrayCollection (@ca1bb01)
label "updated_time"
[1] Object (@d0254f1)
children mx.collections.ArrayCollection (@ca1bb41)
label "id"
[2] Object (@d026d31)
children mx.collections.ArrayCollection (@ca1bc01)
label "from"
[3] Object (@d029461)
children mx.collections.ArrayCollection (@ca1bcc1)
label "link"
[4] Object (@d029b81)
children mx.collections.ArrayCollection (@ca1bd01)
label "type"
[5] Object (@d029b39)
[6] Object (@d02d491)
[7] Object (@d076671)
[8] Object (@d06f941)
[9] Object (@cb3e629)
[10] Object (@d0235e1)
[11] Object (@d0239b9)
[12] Object (@d024ef9)
source [] (@d07e0d9)
label "1"
[2] Object (@d023269)
[3] Object (@d02f941)
[4] Object (@d02d6d1)
[5] Object (@d023479)
[6] Object (@d076491)
[7] Object (@cb3ea19)
[8] Object (@cf9b4a9)
[9] Object (@cf992f9)
[10] Object (@cfac689)
[11] Object (@cfa9d19)
[12] Object (@d0797d9)
[13] Object (@d02b2b1)
[14] Object (@d02ffb9)
[15] Object (@d025ca1)
[16] Object (@cfa2629)
[17] Object (@cfac2c9)
[18] Object (@cfb8c71)
[19] Object (@cfc4bb1)
[20] Object (@cfb8a91)
[21] Object (@cf99bb1)
[22] Object (@d0ad569)
[23] Object (@c9681f1)
[24] Object (@d0a7959)
source [] (@ca7c061)
和我的方式也不能相信,使其顯示在項目呈現!
項目渲染代碼是相當簡單
<label text={data.??">
我不知道該怎麼添加數據後,我嘗試了很多東西,但沒有工作\:
發表您的數據樣本,併發布您當前的渲染器「displaynews」不要害羞與您的代碼,我們不會笑 –
即時通訊添加它在我的問題和我的代碼是有點低劣\: – gongo12
好吧剛剛計算出點東西!當即時通訊寫入我的應用程序<標籤文本= {新聞[0] .type}它的作品。但即時通訊在我的應用程序DATAPROVIDER = {news}中提供錯誤是類型錯誤:錯誤#1034:類型強制失敗:無法轉換[] @ c80cb79到mx.collections.IList。 – gongo12