I've been pulling my hair out for the last couple of hours on what 
appears to be a bug with mx:Tree.   I'd like to be able to show the 
"data" associated with a node on mouse rollover.  The handler for the 
"itemRollOver" event can access the data like this:

private function onTreeRollOver(event: ListEvent) : void {
                debugText.text += "data=" + event.itemRenderer.data + " 
index=" + event.rowIndex + "\n******\n";
}

This seems to be no problem when the node on a tree has subnodes.  
However if the node that is rolled-over has no children, the 
itemRenderer.data property is empty.

Am I missing something?  I've been crawling thru the APIs but I don't 
see any other way to get to the data (that works).

Here is a simple test case to illustrate:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical"
    width="800">

    <mx:Tree id="tree1" labelField="@label" showRoot="true" width="100%"
        itemRollOver="onTreeRollOver(event);">
        <mx:XMLListCollection id="MailBox">
            <mx:XMLList>
                <folder label="Mail">
                 <folder label="INBOX"/>
                 <folder label="Personal Folder">
                    <Pfolder label="Business" />
                     <Pfolder label="Demo" />
                         <Pfolder label="Personal" isBranch="true" />
                         <Pfolder label="Saved Mail" />
                    </folder>
                    <folder label="Sent" />
                    <folder label="Trash" />
                </folder>
            </mx:XMLList>
        </mx:XMLListCollection>
    </mx:Tree>
   
    <mx:TextArea id="debugText" width="100%" height="100%" text="" />
   
    <mx:Script>
        <![CDATA[
            import mx.events.ListEvent;
       
            private function onTreeRollOver(event: ListEvent) : void {
                debugText.text += "data=" + event.itemRenderer.data + " 
index=" + event.rowIndex + "\n******\n";
            }
           
        ]]>
    </mx:Script>
   
</mx:Application>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to