I see. What if you go back to your original attempt and set MAX_LINES to 11? Will it then "stop" at 10?
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Monday, November 10, 2008 7:12 AM To: [email protected] Subject: [flexcoders] Re: Help with Custom Text Area (Limited by lines) public class LimitedTextArea extends TextArea { private static const MAX_LINES:int = 10; private var textLength:int = 0; private var storedInput:String; private var limitHit:Boolean = false; public function LimitedTextArea(){ this.addEventListener( KeyboardEvent.KEY_UP, keyUpHandler ); this.addEventListener( KeyboardEvent.KEY_DOWN, keyDownHandler ); this.addEventListener( Event.CHANGE, changeHandler ); } //-------------------------------------------------- // EVENT LISTENERS //-------------------------------------------------- protected override function keyDownHandler(event:KeyboardEvent):void { storedInput = this.text; var tf:TextField = TextField( this.textField ); textLength = tf.length; if( tf.numLines > MAX_LINES ) limitHit = true; } protected override function keyUpHandler(event:KeyboardEvent):void { var tf:TextField = TextField( this.textField ); if( limitHit && tf.length > textLength ){ this.text = storedInput; limitHit = false; } } private function changeHandler( event:Event ):void { var tf:TextField = TextField( this.textField ); if( limitHit && tf.length > textLength ){ this.text = storedInput; limitHit = false; } } //-------------------------------------------------- } This does work if I want to go back and change a letter to a different letter, but I guess another problem I am having is that I want to be able to keep typing as long as I do not go further than the line limit... For instance, let's say I hit my limit, but I hit it like this: a a a a a a a aaaaaaaaaaaa I should be able to go up in the first couple lines and keep typing, because it won't push the bottom line out any further...

