[FONT=Arial][COLOR=#494920]Hey All,
I am populating a tree using an XML file and here is my question:
How do I have one of the branches of the tree expand showing its child nodes on load of my movie(without the user having to click on it)?
Thank you very much in advance for any insight.[/COLOR][/FONT]
umm… your gonna have to be more clear in what you are asking of us, I could show you 15 different ways to build a dynamic tree.
Post some code, that might help.
ive got the tree, I just need to know how when the movie launches that it automatically opens the first branch for you.
thanx for the response!
I know there’s gotta be someone who knows how to do this!
This should work:
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
trace("success");
myTree.dataProvider = myXML.firstChild;
myTree.setIsOpen(myTree.getTreeNodeAt(0), true, true, true);
};
myXML.load("tree.xml");
The only important part is that this function runs when it loads:
myTree.setIsOpen(myTree.getTreeNodeAt(0), true, true, true);
YOURE THE MAN!!! THANX SO
I’m glad it worked for you 
It’s actually pretty easy, but of course not well documented.
Here’s the code:
var my_tr:mx.controls.Tree;
my_tr.setSize(200, 100);
var trDP_xml:XML = new XML();
trDP_xml.ignoreWhite = true;
trDP_xml.onLoad = function(success:Boolean){
my_tr.dataProvider = trDP_xml.firstChild;
my_tr.setIsOpen(my_tr.getTreeNodeAt(0), true); //this opens the root node
my_tr.setIsOpen(my_tr.getTreeNodeAt(0).getTreeNodeAt(1), true);//this opens the second node under the root node
}
trDP_xml.load("mytree.xml");
And that’s all there is to it… remember that everything is 0 index. Meaning that the first one is actually zero the second is “one” and so on.
Ummm…yeah… ehhhe a little late.
a little, but thank you for the reply anyways! I appreciate the help!