diff --git a/src/as/com/threerings/flex/FlexUtil.as b/src/as/com/threerings/flex/FlexUtil.as index 62f0282d..7f1228bb 100644 --- a/src/as/com/threerings/flex/FlexUtil.as +++ b/src/as/com/threerings/flex/FlexUtil.as @@ -24,6 +24,7 @@ package com.threerings.flex { import mx.controls.Label; import mx.controls.Spacer; +import mx.core.Container; import mx.core.UIComponent; /** @@ -68,6 +69,21 @@ public class FlexUtil return spacer; } + /** + * Return a count of how many visible (includeInLayout=true) children + * are in the specified container. + */ + public static function countLayoutChildren (container :Container) :int + { + var layoutChildren :int = container.numChildren; + for each (var child :Object in container.getChildren()) { + if ((child is UIComponent) && !UIComponent(child).includeInLayout) { + layoutChildren--; + } + } + return layoutChildren; + } + /** * In flex the 'visible' property controls visibility separate from whether * the component takes up space in the layout, which is controlled by 'includeInLayout'.