Return to Snippet

Revision: 44788
at April 18, 2011 15:05 by christowiz


Initial Code
var prevText:String;
inputfield.addEventListener(Event.CHANGE, onUpdate);
 
private function onUpdate(e:Event):void {
     if (inputfield.textHeight >= inputfield.height){
           inputfield.text = prevText;
     }else prevText= inputfield.text;
}

Initial URL
http://blog.designreact.co.uk/2010/06/as3-limit-the-number-of-lines-in-an-input-textfield/

Initial Description
I made one adjustment to the code because I was getting one scrolling extra line.

    inputfield.textHeight > inputfield.height
to:

    inputfield.textHeight >= inputfield.height

Initial Title
Limit the number of lines in an input textfield

Initial Tags


Initial Language
ActionScript 3