TextField height not working

592 Views Asked by At

I'm creating a Word processing Flash desktop app, i created an INPUT text field where the user can type text and play with it, i gave it the following parameters:

//creating a the Text field
var tfield:TextField = new TextField();

//Position & Dimensions
tfield.x=0;
tfield.y=160;
tfield.width = 1280;
tfield.height = 600;  // <<<==== where the probleme is

//Options
tfield.type = TextFieldType.INPUT;
tfield.background=true;
tfield.border=true;
tfield.multiline=true;
tfield.wordWrap = true;

//Add text field to stage
stage.addChild(tfield); 

Everything works fine except the tfield.height = 600; the text field takes the height of one line, and if i add a 2nd or 3rd line, then it expands.

App image: https://image.ibb.co/en5BEm/qsd.png

Adding some lines: https://image.ibb.co/i7HmfR/2nd.png

I want it to be exactly 600px. any ideas?

1

There are 1 best solutions below

0
Vesper On BEST ANSWER

This behavior is related to TextField's autoSize property, which alters its height and width depending on text inside and multiline property. To set the fixed height, assign this property a value of TextFieldAutoSize.NONE. This will disable automatic resize of a text field.