Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why setIsOpen() doesn't work for a tree component

Status
Not open for further replies.

rexyanhx

Programmer
Jun 13, 2007
2
CA
I want to open a node of a tree component when it is loading. But when I used setIsOpen(), it doesn't work. My script is as follows:

var myTree:mx.controls.Tree;
var myTreeDP:XML = new XML();
myTreeDP.ignoreWhite = true;
myTreeDP.load("test.xml");

myTreeDP.onLoad = function(success:Boolean) {
myTree.dataProvider = this.firstChild;
myTree.setIsOpen(myTree.getTreeNodeAt(1),true, true);

};

Please help me!

Thanks in advance.
 
It works for me. But [tt]setIsOpen()[/tt] will not work if there is no node to open. [tt]myTree.getTreeNodeAt(1)[/tt] is the second node in the XML - does your XML has second child node?

Kenneth Kawamoto
 
You are right, Kenneth. My XML has no second child node, so when I tried:
myTree.setIsOpen(myTree.getTreeNodeAt(0),true, true);

I does work.

Thank you so much, Kenneth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top