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-28 Thread Éric Thibault

I've placed the code on (not inside)  the tree instance ...

onClipEvent(load) {

...code...

}

;-)

Martin Schafer 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
Programmeur analyste
Réseau de valorisation de l'enseignement
Université Laval, pavillon Félix-Antoine Savard
Québec, Canada
Tel.: 656-2131 poste 18015
Courriel : [EMAIL PROTECTED]

===

Avis relatif à la confidentialité / Notice of Confidentiality / Advertencia de 
confidencialidad 

___
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-28 Thread Martin Schafer
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:


here is the code I used in a project... hope it helps!  :-)

function ExpendAll() {
 var i:Number;
   var j:Number;
   j = this.length;
 for(i = 0; i < j; i++) {
   var oNode:XMLNode = this.getTreeNodeAt(i);
   var ValeurCourrante:Number = 0;
   if(oNode != undefined) {
   if(this.getIsBranch(oNode)) {
   this.ExpandNode(oNode);
   i=0;
   j = this.length;
   }
   }
   }   }

//Ouvre un noeud incluant les enfants si présents
function ExpandNode (oNode:XMLNode) : Void {

   this._parent._parent.ActionLongeurNoeud(oNode, true);
   if(this.getIsBranch(oNode)) {
   this.setIsOpen(oNode, true);
   if(oNode.childNodes.length > 0) {
   var j:Number;
   for(j = 0; j < oNode.childNodes.length; j++) {
   var oSubNode:XMLNode = oNode.childNodes[j];
   this.ExpandNode(oSubNode);
   }
   }
   }   }
//Ferme tout l'arbre incluant les enfants si présents
function CloseAll() {
   var i:Number;
   var j:Number;
   j = this.length;
 for(i = 0; i < j; i++) {
   var oNode:XMLNode = this.getTreeNodeAt(i);
   if(oNode != undefined && this.getIsBranch(oNode)) {
   this.CloseNode(oNode);
   i=0;
   j = this.length;
   }  }   }
//Ferme le noeud courrant incluant les enfants si présents
function CloseNode(oNode:XMLNode, Mode:Number, Racine:Boolean) : Void {
 if(this.getIsBranch(oNode) and this.getIsOpen(oNode)) {

   if(oNode != this.getTreeNodeAt(0)) {  
this.setIsOpen(oNode, false);

   }
   if(oNode.childNodes.length > 0) {
   var j:Number;
   for(j = 0; j < oNode.childNodes.length; j++) {
   var oSubNode:XMLNode = oNode.childNodes[j];
   this.CloseNode(oSubNode,0,false);
   }
   }
   }   }




Martin Schafer wrote:


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:

 






___
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-28 Thread Éric Thibault

here is the code I used in a project... hope it helps!  :-)

function ExpendAll() {
  
   var i:Number;

   var j:Number;
   j = this.length;
  
   for(i = 0; i < j; i++) {

   var oNode:XMLNode = this.getTreeNodeAt(i);

   var ValeurCourrante:Number = 0;
   if(oNode != undefined) {
   if(this.getIsBranch(oNode)) {
   this.ExpandNode(oNode);
   i=0;
   j = this.length;
   }
   }
   }   
}


//Ouvre un noeud incluant les enfants si présents
function ExpandNode (oNode:XMLNode) : Void {

   this._parent._parent.ActionLongeurNoeud(oNode, true);
   if(this.getIsBranch(oNode)) {
   this.setIsOpen(oNode, true);
   if(oNode.childNodes.length > 0) {
   var j:Number;
   for(j = 0; j < oNode.childNodes.length; j++) {
   var oSubNode:XMLNode = oNode.childNodes[j];
   this.ExpandNode(oSubNode);
   }
   }
   }   
}

//Ferme tout l'arbre incluant les enfants si présents
function CloseAll() {
   var i:Number;
   var j:Number;
   j = this.length;
  
   for(i = 0; i < j; i++) {

   var oNode:XMLNode = this.getTreeNodeAt(i);
   if(oNode != undefined && this.getIsBranch(oNode)) {
   this.CloseNode(oNode);
   i=0;
   j = this.length;
   }   
   }   
}

//Ferme le noeud courrant incluant les enfants si présents
function CloseNode(oNode:XMLNode, Mode:Number, Racine:Boolean) : Void {
  
   if(this.getIsBranch(oNode) and this.getIsOpen(oNode)) {


   if(oNode != this.getTreeNodeAt(0)) {   
   this.setIsOpen(oNode, false);

   }
   if(oNode.childNodes.length > 0) {
   var j:Number;
   for(j = 0; j < oNode.childNodes.length; j++) {
   var oSubNode:XMLNode = oNode.childNodes[j];
   this.CloseNode(oSubNode,0,false);
   }
   }
   }   
}





Martin Schafer wrote:


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:

 



--
===

Éric Thibault
Programmeur analyste
Réseau de valorisation de l'enseignement
Université Laval, pavillon Félix-Antoine Savard
Québec, Canada
Tel.: 656-2131 poste 18015
Courriel : [EMAIL PROTECTED]

===

Avis relatif à la confidentialité / Notice of Confidentiality / Advertencia de 
confidencialidad 

___
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


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


[Flashcoders] Open all Branches of a Tree Component

2005-10-27 Thread Martin Schafer
Hello Everyone,

I am desperately trying to open all branches of a tree component that has
been created via XML and Remoting.

Found this code out on the Internet but can't seem to get it to work.

function openFolders(Node){

elArbol.setIsOpen(Node,true);
var Nodes = Node.childNodes;

for (var i=0; i< Nodes.length; i++) {
if(Nodes.hasChildNodes()){
openFolders(Nodes);
}
}



}

The name of my Instance name of my tree component is this.main.myBM and the
openFolders function should be called like:

OpenFolders(main.myBM);


Any help would be greatly appreciated!

Martin :)



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