flex 展开树

//expend tree
private function expendtree():void
{
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);
    }
       }
        }

你可能感兴趣的:(xml,Flex)