0

我有一个要使用 TileList 显示的关联数组。但是,它不明白喂给它的是什么。我得到的只是 TileList 中的 [object]。

[bindable]
public var people as array = new array();

private function loadArray():void{
people = decoded JSON array
showPeople.dataProvider = people;}

<mx:Tilelist id="showPeople" labelField="{data.name}" iconField="{data.imgURL}"/>

我尝试使用 mx:itemRender 但它只会呈现一个且只有一个项目,即人名的字符串或 url 的图像。最终目标是让 TileList 使用数组中的 URL 及其名称作为标签显示一个人的图片。有什么建议吗?

数组看起来像这样 'name' => 人名字符串 'img' => img URL 字符串

4

1 回答 1

0

您应该使用自定义项目渲染器,如下所示:

<mx:itemRenderer>
  <mx:Component>
    <mx:HBox>
      <mx:Text width="100" height="100" text="{data.name}"/>
      <mx:Image width="100" height="100" source="{data.imgURL}"/>
    </mx:HBox>
  </mx:Component>
</mx:itemRenderer> 

通过这种方式,您可以根据需要自定义列表项。

于 2010-04-08T05:53:59.627 回答