When I programmatically create a new component and then call getBounds() on it, I find that the result in not accurate, for instance (this is in the constructor of a class that extends Sprite):
mButton = new Button(); addChild(mButton); var buttonBounds:Rectangle = mButton.getBounds(this); trace(buttonBounds.toString());
The result is (x=0, y=0, w=100, h=100), h being an incorrect value.
If I create an enterFrame handler and measure the bounds in this, I find it is only in the second execution of enterFrame, that the correct dimensions of the component are reported.
My questions are:
Can I always rely on the second execution of enterFrame after the creation of a component to measure its bounds?
Is there a better way to determine when a newly-created component is ready to have its bounds measured? (e.g. an event that is fired once only after the component is ready)