A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Resize text box dynamically?

  1. #1
    Senior Member
    Join Date
    Dec 2000
    Posts
    181

    Resize text box dynamically?

    Hi all,

    I need to create a single-line text box that loads from an external text file. I have no problem with this, except that I need the box to "expand" to the right to the size of the imported text, and I can't figure out how to do that!

    I'm making a kind of horizontal "subtitle scroller" that's controlled by a slider, so basically I need to have one long text box that stretches off to the right far enough to display all the text that's loaded into it.

    Any ideas?

  2. #2
    Senior Member
    Join Date
    Dec 2000
    Posts
    181
    I guess I could just put a large amount of placeholder text in the fla, that's bigger than anything I'd want to load dynamically; just thought there might be a more elegant way to do it...

  3. #3
    flash fiend
    Join Date
    Dec 2000
    Location
    Bellingham, WA
    Posts
    63
    textBoxInstance._width = textBoxInstance.textWidth;

    the same can be done for the height:

    textBoxInstance._height = textBoxInstance.textHeight;

    works great, but I've noticed with some fonts you have to add an additional 5-10 pixels
    My flash never has bugs, it just develops random features.

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    TextField.autoSize In the AS dictionary.

  5. #5
    Senior Member
    Join Date
    Dec 2000
    Posts
    181
    Thanks guys, those both look like good options!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center