views:

204

answers:

2

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.

A: 

Please give me the full text of the error, and indicate which line of source code the error is pointing at.

My guess is that you are confused about the differences between classes and instances, but it's not possible to answer fully without more details.

davr
+1  A: 

Have you tried: `itemRenderer="{controller.listItemRendererFunction}"

quoo