Problem: A list is visually made up of as many itemrenderers as the height of that control allows. There are times where you want to do an action on a previously itemrenderer focus that is about to be closed or out of focus. The problem is that there needs to be a reference to that old itemrenderer instance when the user selects a new instance.
Solution: On click of the list, remember the previous list.selectedIndex. Then access the list component’s datagroup property. Then extract the itemRenderer
protected function list_clickHandler(event:MouseEvent):void
{
var dataGroup:DataGroup = list.dataGroup;
var itemRenderer:IItemRenderer = dataGroup.getElementAt(list.selectedIndex) as IItemRenderer;
}
Now you can invoke public methods or public properties on that itemrenderer instance
Recent Comments