I haven't checked but I guess that the TextEvent.text property is empty if you are deleting text. If that's the case, then don't cancel the event.
-- Laurent Cozic Flash, Flex and Web Application development http://pogopixels.com ----- Original Message ---- From: tchredeemed <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Tuesday, August 5, 2008 2:57:32 PM Subject: [flexcoders] Re: TextArea - Limit the amount of text Ok, that is definitely a step in the right direction. 1 problem: After they hit that max, it doesn't allow them to go back and change old text that they already edited, because the textHeight has been reached, so it prevents them from changing (essentially setting enabled=false) . Any ideas? --- In [EMAIL PROTECTED] ups.com, Laurent Cozic <pogopixels@ ...> wrote: > > 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.addEventLi stener(TextEvent .TEXT_INPUT, textArea_textInput) ; > > protected function textArea_textInput( event:TextEvent) { > if (textArea.textHeigh t > textArea.height - textArea.getStyle( "fontSize" )) { > event.preventDefaul t(); > } > } > > > > -- > Laurent Cozic > > Flash, Flex and Web Application development > http://pogopixels. com > > > > ----- Original Message ---- > From: tchredeemed <[EMAIL PROTECTED] > > To: [EMAIL PROTECTED] ups.com > 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. >