You could do it by listening to the textInput event. When it's triggered, check
if the text height is above a certain limit (for example the TextArea height -
font height): if it is, cancel the event.
The code below should work:
textArea.addEventListener(TextEvent.TEXT_INPUT, textArea_textInput);
protected function textArea_textInput(event:TextEvent) {
if (textArea.textHeight > textArea.height - textArea.getStyle("fontSize")) {
event.preventDefault();
}
}
--
Laurent Cozic
Flash, Flex and Web Application development
http://pogopixels.com
----- Original Message ----
From: tchredeemed <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, August 5, 2008 2:27:55 PM
Subject: [flexcoders] TextArea - Limit the amount of text
I am creating a web-to-print Greeting Card Editor.
I need to limit the amount of text someone can put in the editable
field (obviously cannot print more than the printable area).
I cant just do maxChars, because it can fit variable amount depending
on the amount of i's and w's used, etc!
any help is appreciated.