Thanks, Adam. I should have added more details to my post.
The 'complexity' is introduced by the fact that I am having to find
all Validator components, which are not DisplayObjectContainers.
Using Object (implemented by each validator subclass) in the
recursive function does not work either, since it catches components
such as flash.display.Shape, which doesn't have any children.
On Nov 5, 2007, at 11:14 PM, aduston1976 wrote:
Why does it get complex with nested sets of child components? Why
can't you just use a recursive function?
function doSomethingToAllDescendants(component :
DisplayObjectContainer) : void {
for (var i : int = 0; i < component.numChildren; i++) {
doSomethingToComponent(component.getChildAt(i));
if (component.getChildAt(i) is DisplayObjectContainer)
doSomethingToAllDescendants(DisplayObjectContainer
(component.getChildAt(i)));
}
}
Sorry if i left out some curlies or semicolons here.
Adam
--- In flexcoders@yahoogroups.com, Jurgen Beck <[EMAIL PROTECTED]> wrote:
>
> I need to traverse the list of all children in a component. What's
> the best approach to doing that? It gets fairly complex with nested
> sets of child components, so I'm looking for an efficient solution.
>
> Thanks,
>
> Jurgen
>