Hi,

I think I have found a bug in the TileList component but since I'm 
new to Flex I would like a second opinion.

If I filter or scroll a TileList with a custom item renderer, then 
change state and back again I get the following error message:

Main Thread (Suspended: TypeError: Error #1010: A term is undefined 
and has no properties.)
mx.controls.listClasses::TileBase/createItemRenderer

The action that causes the error is on line 1952 in TileBase.as:
delete freeItemRenderersByFactory[factory][renderer];

What it does it that its trying to recycle a itemRenderer that should 
be available and then delete it from the Dictionary 
freeItemRenderersByFactory. But somehow that IR is not present in the 
Dictionary and it there fails.

I've googled but didnt find anything about this so I'm starting to 
think I messed something up.

I've managed to reproduce the error with the following code. Just 
copy and past, all in one file.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" xmlns:ns1="*" width="420" height="350">
        
        <mx:states>
                <mx:State name="dummyState">
                        <mx:AddChild position="lastChild">
                                <mx:Label text="Dummy state" 
fontSize="30" verticalCenter="-25" horizontalCenter="0"/>
                        </mx:AddChild>
                        <mx:RemoveChild target="{linkbutton1}"/>
                        <mx:AddChild position="lastChild">
                                <mx:LinkButton label="Show TileList 
State" click="currentState=''" left="10" top="10"/>
                        </mx:AddChild>
                        <mx:RemoveChild target="{tilelist}"/>
                        <mx:RemoveChild target="{radiobutton2}"/>
                        <mx:RemoveChild target="{radiobutton1}"/>
                </mx:State>
        </mx:states>

        <mx:Script>
                <![CDATA[
                        import mx.controls.Label;
                        import mx.collections.ArrayCollection;
                        
                        [Bindable] private var ac : ArrayCollection = 
new ArrayCollection([{name: "one"},{name: "two"}]);
                        
                        private function applyFilter() : void
                        {
                                ac.filterFunction = filter;
                                ac.refresh();
                        }
                        
                        private function removeFilter() : void
                        {
                                ac.filterFunction = null;
                                ac.refresh();
                        }                       
                        
                        private function filter( item : Object ) : 
Boolean
                        {
                                return ( item.name == "one" ) ? 
true : false;
                        }
                ]]>
        </mx:Script>
        
        <mx:RadioButton id="radiobutton1"
                label="Show all" selected="true" 
groupName="radiogroup"
                click="removeFilter()" left="10" top="40"/>
                
        <mx:RadioButton id="radiobutton2"
                label="Show &quot;one&quot;" selected="false" 
groupName="radiogroup" 
                click="applyFilter()" left="88" top="40"/>      
                
        <mx:TileList id="tilelist" 
                dataProvider="{ac}"
                itemRenderer="{new ClassFactory( Label )}" left="10" 
right="10" bottom="99" top="70"/>

        <mx:LinkButton id="linkbutton1" 
                label="Show Dummy State" 
                click="currentState='dummyState'" 
                left="10" top="10" />
        
        <mx:TextArea x="10" y="259" width="400" height="81" 
                text="Steps to reproduce error:&#xa;1. Click 
radiobutton labeled &quot;Show one&quot; to filter 
ArrayCollection.&#xa;2. Click &quot;Show Dummy State&quot;.&#xa;3. 
Click &quot;Show TileList State&quot;." color="#000000" 
fontWeight="bold" fontSize="10"/>
        
</mx:Application>

Reply via email to