# Getting width of Sprite with component inside it

**URL:** <https://forum.kirupa.com/t/getting-width-of-sprite-with-component-inside-it/289696>\
**Category:** flash\
**Created:** [June 3, 2009, 2:39pm UTC](https://forum.kirupa.com/t/getting-width-of-sprite-with-component-inside-it/289696 "2009-06-03T14:39:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 3, 2009, 2:39pm UTC](https://forum.kirupa.com/t/getting-width-of-sprite-with-component-inside-it/289696/1 "2009-06-03T14:39:40Z")

</div>

Hello,

I’m not sure why I can’t get the width of a Sprite when it has components in it.

For example

```auto

var foo:Sprite = new Sprite();
addChild(foo);

var comboBox:ComboBox = new ComboBox();
comboBox.setSize (300, 30);

foo.addChild(comboBox);

trace(foo.width); // outputs 100 ???

```

I’m assuming the component possibly isn’t set before I’m trying to get the width? Doesn’t make sense though.

Thanks  
D
