# TextField autoResize issue?

**URL:** <https://forum.kirupa.com/t/textfield-autoresize-issue/243203>\
**Category:** flash\
**Created:** [November 4, 2007, 9:30am UTC](https://forum.kirupa.com/t/textfield-autoresize-issue/243203 "2007-11-04T09:30:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IlTimido](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@IlTimido](https://forum.kirupa.com/u/IlTimido)\
**Post date:** [November 4, 2007, 9:30am UTC](https://forum.kirupa.com/t/textfield-autoresize-issue/243203/1 "2007-11-04T09:30:43Z")

</div>

Hello to everyone.  
Sorry if this has been treated before but I searched through the threads but I haven’t found nothing about this.

Please have a look at the code below (I just create a TextField auto-resizing and I put some text in it):

[As]  
package{  
import flash.display.MovieClip;  
import flash.text.TextField;  
import flash.text.TextFieldAutoSize;

public class WeirdBehaviour extends MovieClip{  
// A long string  
private var sText:String =  
“Lorem ipsum causae adversarium per no, est ipsum numquam suscipiantur eu.”+  
“Prima affert exerci vix in, usu in eleifend pericula, est no odio diam vocent.”;  
// Pointer to the TextField that I will create  
var txt:TextField = null;  
public function WeirdBehaviour():void{  
// 1) I create the TextField  
txt = new TextField();  
// 2) I set width and height:  
// height set at 0 because I can’t tell how high it would be after the resize  
// and I don’t want its heigth at 100 (that is the default value)  
txt.width = 300;  
txt.height = 0;  
// 3) I set the autoSize in order to resize it and the wordwrap to true  
txt.autoSize = TextFieldAutoSize.CENTER;  
txt.wordWrap = true;  
// 4) I set the text  
txt.text = sText;  
// 5) I add it to the display  
addChild(txt)  
// 6) the trace result is really weird!  
trace(txt.height);  
trace(txt.height);  
}  
}  
}  
[/As]

The weird thing is the output of the two trace:  
**19 (first trace)**  
**49 (second trace)**

But if I comment the line “\*\*txt.height = 0;” \*\*all works fine.

Also… without commenting the line but by setting:  
**txt.height = 4;**  
it works fine!

Instead with:  
**txt.height = 3;** (or 2 or 1)  
it doesn’t work

Where am I wrong? Is this a known issue?  
Thanks in advance
