expandItem() on a node on a Tree works fine when the dataprovider is a
hard-coded XML or XMLList in the mxml, but when the dataprovider is a
variable of type XML or XMLList, expandItem() doesn't do anything.

code example (should expand the node, but doesn't):

---

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:Script>
        <![CDATA[                  
            [Bindable]
            private var xlc:XMLList;
                        
            private function initTree() : void
            {
                //xlc = treeData2;
                var myNode : XMLList = new XMLList(<node
label='Buddies'><node label='master' email='[EMAIL PROTECTED]'
/> </node>)
                //treeData2 = "" + treeData2;
                XML(treeData2).insertChildBefore(treeData2.node[0], myNode);
                imTree.dataProvider = treeData2;  //tried this just in
case, but it makes no difference
                openTreeNodes();
            }
            private function openTreeNodes():void{
                //open the first two folders in IM tree
                imTree.expandItem(treeData2.node[0], true, true);
                trace("treeData2.node[0] = "+treeData2.node[0]);
                //trace("treeData2[0] = "+treeData2[0]);
                //imTree.expandItem(XMLList(imTree.dataprovider)[0],
true, true);
            }
        ]]>
    </mx:Script>
    <mx:XML id="treeData2">
                <tree>
            <node label="CoWorkers">
                <node label="Ewoldt"/>
                <node label="Swingler"/>
            </node>
            <node label="Offline">
                <node label ="Bini" />
            </node>
        </tree>   
    </mx:XML>

                <mx:Tree id="imTree" width="100%" height="100%" 
labelField="@label"
                        showRoot="false" dataProvider="{treeData2}"
                        creationComplete="initTree()"/>
</mx:Application>






--
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