Added countLayoutChildren(), which counts the children of a container that

have includeInLayout = true.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@668 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2008-10-15 20:45:27 +00:00
parent fcf091b5c1
commit a19690f205
+16
View File
@@ -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'.