views:

93

answers:

2

I have a flex tree that worked perfectly fine when we set the defaultLeafIcon={null} and the folderClosedIcon and folderOpenIcon to {null}. We decided to put the icons back in and took out the nulls. Now they show up fine, but if you click on the icon instead of the label or the rest of the row, it seems to change the selected item, shows the highlight around the new item, but doesn't dispatch the ItemClick event. This makes it really hard to know that the tree's selected item has changed! The weird part is that once you have clicked on the icon once and it looked like the selectedItem changed (or at least it applied that style), if you click the same icon again, it will actually fire the itemClick event. if you click any other icon, it does the same thing again, switching the selectedItem and styling that row, but not firing the itemClick event.

Any ideas? Thanks. (This is in flex 4 btw)

+1  A: 

We had that problem and it turned out that because we were using a SWF as the source and referencing a symbol in the SWF as an icon, then clicking on that icon seemed to intercept and bury the click event. This is what we had:

[Embed(source='assets/icons.swf', symbol='folder')]
private var folderIcon:Class;

We solved the problem by converting the icons to PNG files and everything worked fine.

[Embed(source='assets/folder.png')]
private var folderIcon:Class;
Robusto
We're not using a custom image, just the default. I wonder if by default it uses a swf icon.
Xshare
A: 

don't know how it's really done for Tree component

but for AdvancedDataGrid this worked:

<mx:AdvancedDataGrid>
        <mx:groupItemRenderer>
            <mx:Component>
                <mx:AdvancedDataGridGroupItemRenderer mouseEnabled="true"/>
            </mx:Component>
        </mx:groupItemRenderer>
</mx:AdvancedDataGrid>

maybe

 <mx:Tree>
        <mx:itemRenderer>
            <mx:Component>
                <mx:TreeItemRenderer mouseEnabled="true"/>
            </mx:Component>
        </mx:itemRenderer>
    </mx:Tree>
dragonkhan