# Finding bounds of a component

**URL:** <https://forum.kirupa.com/t/finding-bounds-of-a-component/288428>\
**Category:** flash\
**Created:** [May 15, 2009, 3:13pm UTC](https://forum.kirupa.com/t/finding-bounds-of-a-component/288428 "2009-05-15T15:13:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AKirk](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@AKirk](https://forum.kirupa.com/u/AKirk)\
**Post date:** [May 15, 2009, 3:13pm UTC](https://forum.kirupa.com/t/finding-bounds-of-a-component/288428/1 "2009-05-15T15:13:00Z")

</div>

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):

```auto

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:

1. Can I always rely on the second execution of enterFrame after the creation of a component to measure its bounds?

2. 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)

Thanks  
Andy
