0

i have a HorizontalList filled with a dataProvider (ArrayCollection) like :

[Bindable]
[Embed(source="assets/empty.jpg")]
public var empty:Class;


private function init(nbr){
    var myArray : ArrayCollection = new ArrayCollection;

    for( var i=0 ; i<nbr ; i++){
        myArray.addItem({label:"Page" + i , icon:"empty"});
    }
    myHorizontalList.dataProvider = myArray;
}

for some reason i have to do the following, when an item is clicked the icon image of this very item must change to some other image.

can anybody help me please. i'm new to flex thank you

4

1 回答 1

1

您应该使用列表中的更改事件。那应该调用一种方法来更改所选图像。像这样的东西:

<mx:List id="imageList" dataProvider="{dataList}" change="{onChange(event)}" />

public function onChange(event:Event):void
{
    image.source = imageList.selectedItem.url; 
}

如果您需要任何进一步的解释,请告诉我。

于 2012-05-21T18:05:16.433 回答