我有一個ArrayCollection對象。 我將這個數組作爲數據提供者傳遞給horizonallist,並使用自定義的itemRenderer。Flex-Typed ArrayCollection作爲Horizontallist的數據提供者
在執行應用程序時,HorizontalList將被顯示
[object CustomClass][object CustomClass][object CustomClass][object CustomClass]
我試過在鑄造的itemRenderer每個對象如下:
<mx:Label text="{(data as CustomClass).label1}"/>
但它不工作...
感謝您提供任何幫助。 問候,
BS_C3
編輯 - 2010
03月09日我們去一些代碼=)
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Component id="Item">
<mx:VBox width="180">
<mx:HBox width="100%">
<mx:Spacer width="100%"/>
<mx:Button label="x"/>
</mx:HBox>
<mx:Image id="thumbnail"/>
<mx:Label width="100%" horizontalCenter="0" text="Collection"/>
<mx:HBox width="100%">
<mx:Label width="100" text="GIA"/>
<mx:Label text="{data.charg_st}"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Finger Size"/>
<mx:Label text="xxxxxx"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Carat"/>
<mx:Label text="{data.carats}"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Color"/>
<mx:Label text="{data.color}"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Clarity"/>
<mx:Label text="{data.clarity}"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Shop"/>
<mx:Label text="{data.lgort_fp}"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Resizing"/>
<mx:Label text="{data.resizing}"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="100" text="Price Excl. VAT"/>
<mx:Label text="{data.net_price_fp}"/>
</mx:HBox>
</mx:VBox>
</mx:Component>
<mx:HorizontalList
dataProvider="{GlobalData.instance.tray}"
columnCount="4"
rowCount="1"
horizontalScrollPolicy="off"
itemRenderer="{Item}"
/>
</mx:Canvas>
僅供參考,horizonalList dataProvider是對象的ArrayCollection。
現在,horizontallist正在顯示空的項目...以正確的寬度... arraycollection不是空的(我對項目上的click事件使用警報,並且檢索預期的數據)。
希望這將有助於> _ <
問候, BS_C3
您可以添加更多的代碼或一個完整的測試用例? – Patrick 2010-03-09 10:59:35
沒有人有解決方案? 我一直在嘗試不同的解決方案,但它仍然無法正常工作。 itemrenderer中的所有內容都顯示爲「BLANK」。 這就像物品在那裏,但有東西隱藏它。 我已經添加了一個itemClick事件來顯示該項目的數據,它確實顯示... 我也重新創建了arraycollection作爲一個arraycollection的對象......並且它不改變horizontallist的行爲。仍然得到一個空白項目... 我真不明白> _ < 任何線索? – 2010-03-12 09:58:38