A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: adjusting dynamic textfield, to fit its contents

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    98

    adjusting dynamic textfield, to fit its contents

    I have a dynamic textfield "name" that is inside an mc on the main stage. This textbox gets changed by a variable being updated on a ClipEvent in another mc. How can I have the "name" text shrink and grow to the width of the contents?
    Fly pelican, fly! ~ Tony Montana

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    look at the autoSize property of the TextField class in your reference.
    code:

    TextField.autoSize


  3. #3
    Member
    Join Date
    Aug 2001
    Posts
    98
    My textfield will display what the variable title holds. I can get it to do this by:
    code:
    _root.info = title;

    But I can't get it to adjust to display all of the variable, it gets cut off. I've tried these two ways:
    code:
    _root.info.autoSize = title;

    and
    code:
    _root.info = title;
    _root.info.autoSize;

    Neither works.
    Last edited by atomicnuke; 11-21-2003 at 02:41 PM.
    Fly pelican, fly! ~ Tony Montana

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    code:

    _root.info.autoSize = true;


  5. #5
    Member
    Join Date
    Aug 2001
    Posts
    98
    In the code refrence in flash, it says saying
    code:
    _root.info.autoSize = left;

    Will change the right and the bottom of the field to fit the contents. Tried that and that didn't work either, or the =true; code.
    Fly pelican, fly! ~ Tony Montana

  6. #6
    Member
    Join Date
    Aug 2001
    Posts
    98
    Anyone, know why this doesn't work?
    Fly pelican, fly! ~ Tony Montana

  7. #7
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    info has to be the instance name of the textfield (the textfield shouldn't have a variable name), assuming the texfield info is on the main timeline you can then use,

    code:

    _root.info.autoSize = "left";
    _root.info.text = title;


  8. #8
    Member
    Join Date
    Aug 2001
    Posts
    98
    Thank you very much, it finally works!
    Fly pelican, fly! ~ Tony Montana

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