expandChildrenOf 展开树

private function expendtree():void
{
// have error
/*var useTime:Timer=new Timer(300,3);
useTime.addEventListener(TimerEvent.TIMER,expend);
    useTime.start();*/
   

       private function expend(event:TimerEvent):void
       {
        var xml_skill_len:int= data_xml.length();
        expendAllTree(myTree1);
        if(xml_skill_len==2)
        {
        expendAllTree(myTree2);
       
        }
        else
        if(xml_skill_len==3)
        {
        //expendAllTree(myTree2);
        //expendAllTree(myTree3);
        }       
        function expendAllTree(myTree:Tree):void
       {
var xml_object:Object=myTree.dataProvider;//treeData 为xml数据名
    var len:int=xml_object.length;//取得树枝的数目
    var i:int=0;
    for(i=0;i<len;i++)
    {
    myTree.expandChildrenOf(xml_object[i],true);
    }
       }
        }    
             function tree_itemClick(evt:ListEvent,tree:Tree):void//展开相应点击的树
             {
                var item:Object = Tree(evt.currentTarget).selectedItem;
                if (tree.dataDescriptor.isBranch(item))
                 {
                    tree.expandItem(item, !tree.isItemOpen(item), true);
                 }
              }     

你可能感兴趣的:(xml)