XML or ArrayCollection?  Probably have to recurse for AC  For xml, I
think you can do myxml..* or something like that.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of bjorn -
Sent: Monday, August 27, 2007 1:51 AM
To: [email protected]
Subject: Re: [flexcoders] Re: Total Number of Items in a Tree

 

Make a recursive count function, maybe.

 

// pseudocode  for tree based on an arraycollection

 

function countNodes( ac:ArrayCollection ): int 

{

   var count:int = 0;

   for(var i:int=0; i < ac.length; i++) {

      count++;

      if(ac[i].hasOwnProperty('children')) {

             count += this.countNodes( ac[i].children );

      }

   }

   return count;

}

 

On 27/08/07, Stefan Schmalhaus <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote: 
>
> Depends on what number you're looking for. The total number of
possible
> nodes or the total number based on what nodes are open

I'm looking for the total number of nodes (branches and leaves), no 
matter whether they are opened or not. 




-- 

======================== 
http://www.juicability.com <http://www.juicability.com>  - flex blog
http://www.43min.com <http://www.43min.com>  - funny movies 

 

Reply via email to