I'm developing some kind of image gallery in Flex 3 + PureMVC and in one of my UI component, I use a repeater, I guess it is a kind of unusual case... Usually it is simply:
Mediator:
someId.addEventListener()...
View component:
[Bindable] public var images:ArrayCollection;
...
<mx:HBox id="thumbnailContainer" width="50%" horizontalCenter="true" horizontalAlign="center" styleName="thumbContainer" backgroundAlpha="0.2" backgroundColor="#433838">
<mx:Repeater id="thumbRepeater" dataProvider="{images}">
<mx:Image source="{String(thumbRepeater.currentItem.thumb)}"
maintainAspectRatio="true"
height="50" width="100%"
click="onChangeCurrentImage(event)"
styleName="selectedThumb" />
</mx:Repeater>
</mx:HBox>
...
private function onChangeCurrentImage(event:MouseEvent):void //, item:Object):void
{
selectedTarget = event.currentTarget;
selectedItem = selectedTarget.getRepeaterItem();
dispatchEvent(new Event(EVENT_CHANGE_CURRENT_IMAGE));
}
And in the mediator:
ui.addEventListener( ItemImagesPanel.EVENT_CHANGE_CURRENT_IMAGE, onChangeCurrentImage);
It is the first time I use a repeater in an UI with PUREMVC Mediator and I'm not sure if I did it right !
I need to get the item data in order to change the image... I hope my post was understabe enough ;-)
Any advices, remarks ?
I guess I could make a custom event and add a "data" property on it...
Thanks!