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]> wrote:
>
>   --- In flexcoders@yahoogroups.com <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 - flex blog
http://www.43min.com - funny movies

Reply via email to