Flex 4 itemRendererFunction problem.
- by michael
This is a Flex 4 application:
I have created a list as the following:
<s:List id="previewList"
horizontalCenter="14"
verticalCenter="-112"
itemRendererFunction="listItemRendererFunction"
click="controller.previewListClickHandler()">
</s:List>
And I have the itemRendererFunction:
public function listItemRendererFunction(item:Object):ClassFactory
{
var cla:Class = SimpleItemRenderer;
if( item.save == true )
{
cla = ColorItemRenderer;
}
else
{
cla = SimpleItemRenderer;
}
return new ClassFactory(cla);
}
The application works fine if the listItemRendererFunction is inside fx:Script.
However, when I put the listItemRendererFunction into a class and change to the following:
itemRendererFunction="controller.listItemRendererFunction"
in the List component.
If I run the application, I get the " Error #1009".
Please advice how to fix it.