/ Published in: ActionScript 3

I made one adjustment to the code because I was getting one scrolling extra line.
inputfield.textHeight > inputfield.height
to:
inputfield.textHeight >= inputfield.height
inputfield.textHeight > inputfield.height
to:
inputfield.textHeight >= inputfield.height
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }
URL: http://blog.designreact.co.uk/2010/06/as3-limit-the-number-of-lines-in-an-input-textfield/
Comments
