In Flex I can create an ItemRenderer to represent each item in the Lists DataProvider but how do I access the instance of the ItemRenderer via the DataProviders Object? Something like myList.getItemRenderer(dp.getItemAt(10));
public function getItemRenderer(list:List, item:Object):ItemRenderer
{
var dataGroup:DataGroup = list.dataGroup;
var n:int = dataGroup.numElements;
for (var i:int = 0; i < n; i++)
{
var renderer:ItemRenderer = dataGroup.getElementAt(i) as ItemRenderer;
if (renderer && renderer.data == item)
return renderer;
}
return null;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With