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:
@@ -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'.
|
||||
|
||||
Reference in New Issue
Block a user