Re: [Flashcoders] Open all Branches of a Tree Component

2005-10-28 Thread Martin Schafer
Eric,

Couldn't get your code to work at first.  Made some slight modifications to
get it to work in a single frame based code structure.

This code works great for relatively small tree structures.  Took around
10-15 seconds to open 1500 nodes. Meanwhile it just sits there without
feedback. 

function ExpandNode (myTree, myTreeNode:XMLNode):Void {
// Open passed in node.
myTree.setIsOpen (myTreeNode, true);
// Check to see if current node has children
if (myTreeNode.childNodes.length  0) {
// If current node has children spawn a new process that will
recurse throuhg all child nodes.
// Effectively opening all nodes in tree.
var j:Number;
for (j = 0; j  myTreeNode.childNodes.length; j++) {
var myTreeSubNode:XMLNode = myTreeNode.childNodes[j];
this.ExpandNode (myTree, myTreeSubNode);
}
}
}
// This executes the initial opening...
// First attribute is the instance name of the tree component
// Second attribute is the root node of the tree component
ExpandNode (main.myBM, main.myBM.getTreeNodeAt (0));

Thanks for all the help!

Martin  :)


On 10/28/05 12:01 PM, Martin Schafer [EMAIL PROTECTED] wrote:

 Looks like it would work but I can't seem to figure out how to bind it
 to a Tree Component.  How to do you get this to refer to the tree
 component instance without having an attribute inside of the ExpandAll
 function? 
 
 Thanks for the info!
 
 Martin :)
 
 Éric Thibault wrote:
 



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Open all Branches of a Tree Component

2005-10-27 Thread Daniel Cascais
Hi Martin,

I've used something like this (can't remeber exactly):



public function setTreeIsOpen(open:Boolean):Void
{
   for(var i:Number = 0; i  tree.length; i++)
   {
  tree.setIsOpen(tree.getTreeNodeAt(i), open, false);
   }
}



Hope it helps.

--
Daniel Cascais
Tel: +56 (0)2  4589495
Cel: +56 (0)9  9417355
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Open all Branches of a Tree Component

2005-10-27 Thread Martin Schafer
Daniel,

I am looking for something that would allow every branch to be recursively
set to Open. Wouldn't the code below only open the children of root?

Martin :)


On 10/27/05 2:06 PM, Daniel Cascais [EMAIL PROTECTED] wrote:

 Hi Martin,
 
 I've used something like this (can't remeber exactly):
 
 --
 --
 
 public function setTreeIsOpen(open:Boolean):Void
 {
for(var i:Number = 0; i  tree.length; i++)
{
   tree.setIsOpen(tree.getTreeNodeAt(i), open, false);
}
 }
 
 --
 --
 
 Hope it helps.
 
 --
 Daniel Cascais
 Tel: +56 (0)2  4589495
 Cel: +56 (0)9  9417355
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders