オブジェクトの ArrayCollection があります。この配列を dataprovider として horizontallist に渡し、カスタム itemRenderer を使用しています。
アプリケーションを実行すると、水平リストが表示されます
[object CustomClass][object CustomClass][object CustomClass][object CustomClass]
次のように、itemrenderer の各オブジェクトをキャストしてみました。
<mx:Label text="{(data as CustomClass).label1}"/>
しかし、それは機能していません...
ご協力いただきありがとうございます。よろしく、
BS_C3
編集 - 2010 年 3 月 9 日
もう少しコードを見てみましょう =)
<?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 データプロバイダーはオブジェクトの ArrayCollection です。
現在、水平リストには空のアイテムが表示されています...正しい幅で... arraycollection は空ではありません(アイテムのクリックイベントでアラートを使用しており、期待されるデータを取得しています)。
これが役立つことを願っています >_<
よろしく、 BS_C3