The \t didn't work nor did typing a tab into the restrict. I have to use the ascii character codes but what's in the docs doesn't work.
FYI - I appreciate the code for the tab. In my case, the user isn't actually typing in the tab. They are cutting and pasting cells from an Excel spreadsheet into the text area. I'm doing this to provide a bulk upload capability into a datagrid. I can easily parse the \t \r combinations into the grid. But I do need to filter the characters allowed. Restrict does this very nicely. IF I could get it to allow tabs.... ----- Original Message ----- From: Glen Walker To: [email protected] Sent: Thursday, June 10, 2010 9:01 AM Subject: Re:TextArea -- allow tab character in restrict property \t is the tab character you would use in a trace() statement. trace( 'hello\tworld' ); Perhaps that'll work in restrict. However, you'll also have to add a listener for FOCUS_CHANGE because by default, hitting TAB will try to move the focus out of your TextArea and to the next object. ta.addEventListener( FocusEvent.KEY_FOCUS_CHANGE, focusChangeH ); I do something like this: private function focusChangeH( e:FocusEvent ):void { if ( _allowTabOut ) _allowTabOut = false; else e.preventDefault(); } I also have a keydown handler that's called when you TAB. I allow a Ctrl+Tab to allow focus to move out of the textarea whereas a regular TAB allows the tab character to be typed. That's where I set my _allowTabOut flag. private function keyDownH(e:KeyboardEvent):void { switch( e.keyCode ) { case Keyboard.TAB: if ( e.ctrlKey ) _allowTabOut = true; else /* other stuff */ /* don't want to call super for TAB */ return; } /* want to SUPER all keyboard events except TAB */ super.keyDownH(e); }

