Skip to main content
magblack22
Known Participant
May 31, 2011
Question

Defining number of lines on a text field

  • May 31, 2011
  • 1 reply
  • 520 views

Hi! I'm working with an input text field that has to contain a max number of characters (90... I set this on the properties panel) and a max number of lines: 6

but i don't know how to set this property.... I've searched, and all I could find was the numLines property, but it doesn't allow to specify the number of lines iI need my text to have..............

Please, do you know if there is a way to set this?

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 31, 2011

use a textfield listener for a change event and check the maxScrollV property.  if that exceeds your limit, truncate the input text.

magblack22
Known Participant
May 31, 2011

...please, can you tell me how do I do that???

thxs!

kglad
Community Expert
Community Expert
May 31, 2011

:

tf.addEventListener(Event.CHANGE,f);

function f(e:Event):void {

if(tf.maxScrollV>1){  // limit the lines

tf.text = tf.text.substr(0,-1);

}

}

function f(e:Event):void {

if(tf.text.length>90){  // limit the characters

tf.text = tf.text.substr(0,-1);

}

}