# Dynamic Text Box Sizing

**URL:** <https://forum.kirupa.com/t/dynamic-text-box-sizing/23368>\
**Category:** flash\
**Created:** [June 17, 2003, 12:29am UTC](https://forum.kirupa.com/t/dynamic-text-box-sizing/23368 "2003-06-17T00:29:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpn](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jpn](https://forum.kirupa.com/u/jpn)\
**Post date:** [June 17, 2003, 12:29am UTC](https://forum.kirupa.com/t/dynamic-text-box-sizing/23368/1 "2003-06-17T00:29:39Z")

</div>

Hi all…

I’m building a scrolling marquee. Simple enough, but I’m wondering if someone can help me with one aspect of it.

I’m passing several strings of text via php that will scroll by in the marquee. These strings are all different lengths, some short, some very long. I’m populating a dynamic text box inside a movie clip. The problem is, is that I don’t know the best way to size this text box. The best way I could think of was to pass the total number of characters in my text to the movie and then do this:

\_root.myMovie.myTextBox.\_width = \_root.numChars \* 7

7 seems to be the magic number, anything smaller cuts some of the end of the text off. Anything longer gives me too big of a box. I need to get it as close to the size of the actual text as possible, because I’m checking for the end of the text box to go by before I send the next string across the marquee with a duplicateMovieClip function.

Hope this makes sense, if someone has a better way or suggestions, please help! Thanks in advance…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 17, 2003, 12:44am UTC](https://forum.kirupa.com/t/dynamic-text-box-sizing/23368/2 "2003-06-17T00:44:21Z")

</div>

yourTargetTextBoxInstanceName.autoSize = true;

Should autosize your dynamic textbox so that it is always the same size as your string.

Unless I am misunderstanding…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 17, 2003, 12:56am UTC](https://forum.kirupa.com/t/dynamic-text-box-sizing/23368/3 "2003-06-17T00:56:36Z")

</div>

I was just on my way back to posting that I’d figured it out… That’s exactly how I did it.

Thanks for the quick reply.

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 17, 2003, 1:06am UTC](https://forum.kirupa.com/t/dynamic-text-box-sizing/23368/4 "2003-06-17T01:06:43Z")

</div>

No problem, glad you got everything working 🙂
