I don't want to allow linewise scrolling(means through arrow key) in textArea in noneditable mode
Without having time to actually write the code, here's what I would do conceptually:
If your
TextAreais not editable, add anEventListenerthat checks to see if theTextAreacurrently has focus. When theTextAreahas the focus yourEventListenershould create anotherEventListenerthat looks for a keyboard event.In your keyboard event
EventListener, check to see if the key that was pressed was an arrow key. If it was an arrow key, trap the event and do nothing.When the
TextArealoses focus, remove theEventListenerthat checks for the arrow keys being pressed.
I hope this helps!
Edit: When a key is pressed on the keyboard, it has a specific keyCode Flex can use to tell which key was pressed. The arrow keys are 37 - 40.
To take from an example (from the Adobe Live Docs):
<mx:Script>
<![CDATA[
private function initApp():void {
myTextArea.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
}
private function keyHandler(event:KeyboardEvent):void {
if(event.keyCode >= 37 && event.keyCode <= 40)
{
event.stopImmediatePropagation();
}
}
]]>
</mx:Script>