RE: [flexcoders] Re: Total Number of Items in a Tree

2007-08-28 Thread Alex Harui
@yahoogroups.com 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

Re: [flexcoders] Re: Total Number of Items in a Tree

2007-08-27 Thread bjorn -
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.count

[flexcoders] Re: Total Number of Items in a Tree

2007-08-27 Thread Stefan Schmalhaus
--- In flexcoders@yahoogroups.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 a