A good and easy example of a recursive function has come to my mind while replying to this question on stackoverflow.

The problem was how to know is a component (mx:UIComponent) was visible or not, just like Component.isShowing() works in Java. You canno’t rely on the visible property of the UIComponent, you have to check every parent to see if it too is visible.

First step in recursion is to block the basic level. If the component reference is null, it is not visible; if the component we are checking is an Application, it should be visible, according to his visible property (it doesn’t have a parent).

All the other cases should check the property, AND the parent’s property. (If a component isn’t on the DisplayList, his parent will be null, and it will not be visible,  and so for all of his children).


GeSHi Error: GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)