# Dynamic size based on font pixel width

**URL:** https://forum.kirupa.com/t/dynamic-size-based-on-font-pixel-width/181812
**Category:** flash
**Created:** [March 13, 2006, 11:09am UTC](https://forum.kirupa.com/t/dynamic-size-based-on-font-pixel-width/181812 "2006-03-13T11:09:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Jt\_01](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Jt\_01](https://forum.kirupa.com/u/Jt_01)
#### Post date: [March 13, 2006, 11:09am UTC](https://forum.kirupa.com/t/dynamic-size-based-on-font-pixel-width/181812/1 "2006-03-13T11:09:17Z")

</div>

Hi, I have some dynamic text with a background box that needs to widen to match the width of the text, this is how I am doing it at the moment, by multiplying by the average pixel width of arial. However it doesnt seem to be that accurate, any ideas?

```auto
_root.caption1.textbg._width = _root.caption1.words.length*7.5

```
