Aha - the key is to provide a dataTipFunction, otherwise the 
tooltips are only displayed when the label is too long to fit within 
the allotted space.

http://livedocs.macromedia.com/flex/2/langref/mx/controls/listClasses
/ListBase.html#showDataTips

I gave it a try, and sure enough the following sample app works.

<?xml version="1.0" encoding="utf-8"?>
<!-- Tree control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>

    <mx:Script>
        <![CDATA[
            import mx.events.ListEvent;

            public function onItemRollOver(event: ListEvent) : void {
                ta.text = [EMAIL PROTECTED];
            }

            public function getDataTip(item: Object) : String {
                return [EMAIL PROTECTED];
            }
        ]]>
    </mx:Script>

    <mx:XMLList id="treeData">
        <node label="Mail Box">
            <node label="Inbox">
                <node label="Marketing"/>
                <node label="Product Management"/>
                <node label="Personal"/>
            </node>
            <node label="Outbox">
                <node label="Professional"/>
                <node label="Personal"/>
            </node>
            <node label="Spam"/>
            <node label="Sent"/>
        </node>    
    </mx:XMLList>

    <mx:Panel title="Tree Control Example" height="75%" width="75%" 
        paddingTop="10" paddingLeft="10" paddingRight="10" 
paddingBottom="10">

        <mx:Label width="100%" color="blue" 
            text="Select a node in the Tree control."/>

        <mx:HDividedBox width="100%" height="100%">
            <mx:Tree width="50%" height="100%" labelField="@label" 
                itemRollOver="onItemRollOver(event as ListEvent)" 
                showDataTips="true" dataTipFunction="getDataTip"
                showRoot="false" dataProvider="{treeData}" />
            <mx:TextArea id="ta" height="100%" width="50%" text=""/>
        </mx:HDividedBox>
        
    </mx:Panel>
</mx:Application>

Reply via email to