Question

In Flex, I have a HBox that contains several elements. The container has clipContent set to true.

What I'd like to know, is what is the actual length of the remaining visual content that would be shown if the clipContant is set to false.

i.e: my HBox has 900 width, I addchild 5 elements, each of 200 width, I'd want to know how to retrieve the 100 that would complete the 200 x 5 total width.

Is there any property that could be used for this purpose?.

Was it helpful?

Solution

You can iterate over the children of the hbox and count the length of all its children.

var childLength:Number = 0;
for (var i:int = 0; i < myBox.numChildren; i++) {
    childLength += myBox.getChildAt(i).width;                   
}
var clippedLength:Number = childLength - myBox.width;

If you're using spark components use numElements and getElementAt(i) instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top