Height of component increasing when adding children

I have a simple flash component that is just a rectangle with a border around it. This component represents my chat box. I then create 20 TextFields that will be overlapped on the component to display text.

The odd thing that is happening is that my components height is originally 200, but with each textfield i add as a child to the component the height data of the component increases by the height of the textfield.

Let me clarify that the height of the object in pixels is not changing, but simply the this.height of the component. I can make a static const that I can use for the original height of the component, but I find this behavior strange.

Could anyone comment on why this is happening?

Thanks!

Answers

This is expected behavior. The height property of a parent will include all of its children, same with the width property.

Any graphics drawn inside of this parent will not change, you would have to update this manually by creating a nested clip and adjusting its size.