bgreenhouse
Technical User
Hi Everyone (again)
I'm now having aproblem with the getChildNodes method. I've found references to a similar problem, but their solutions don't seem to work for me. What I'm trying to do is to loop through every branch on the tree and close it if it's open. Here's what I've got:
There's tons of trace methods in there to see what's happening, and I've commented out the actual muscle of the function. Now - it all goes fine, it tells me the right label of the root node and how many children it has, but then the array from getChildNodes just turns up empty, with a string of commas. This is incredibly similar to this topic: but their solution doesn't seem to apply to me.
Anyone?
B
I'm now having aproblem with the getChildNodes method. I've found references to a similar problem, but their solutions don't seem to work for me. What I'm trying to do is to loop through every branch on the tree and close it if it's open. Here's what I've got:
Code:
function closeAllOtherNodes(tree){
var treeRoot = tree.getRootNode();
trace("treeRoot's label is " + treeRoot.getLabel());
var ArrayChildNodes = treeRoot.getChildNodes();
trace ("result of getChildNodes(): " + treeRoot.getChildNodes());
trace ("Number of children the root has: " + treeRoot.getNumChildren());
trace ("the array's length: " + ArrayChildNodes.length());
//for (child_node in ArrayChildNodes) {
// trace(childnode);
// if (child_node.isBranch() == true) {
// child_node.setIsOpen(false);
// }
//}
}
There's tons of trace methods in there to see what's happening, and I've commented out the actual muscle of the function. Now - it all goes fine, it tells me the right label of the root node and how many children it has, but then the array from getChildNodes just turns up empty, with a string of commas. This is incredibly similar to this topic: but their solution doesn't seem to apply to me.
Anyone?
B