This content has been marked as final. Show 5 replies
textWidth is the textfield's width in pixels. length is the number of characters in your string.
so, your 2nd line of code makes no sense. nevertheless, with a multiline textfield all your text should be viewable by scrolling IF you have wordWrap enabled your textfield.
p.s. i just noticed your last 4 lines of code and that makes even less sense because length is not a property of textfields and textWidth is not a property of strings. and _width is an as2 property. or you using as2 or as3?
i am now using as2.....
but how can i make the dynamic text display just fit the message? (If the dynamic text is not multiline, but single line only)
>>but how can i make the dynamic text display just fit the message? (If the
>>dynamic text is not multiline, but single line only)
Set the _width of the text field to the textWidth of the field...
myField.text = someText;
myField._width = myField.textWidth + 3;
That's all you need. I added the +3 to set the width just a bit bigger than
the text, otherwise it can cut a bit off the last char.
Adobe Community Expert
if you want to size your textfield to "just" fit the text, use the autoSize property of textfields.