preventDefault is only for cancelable events, and KEY_DOWN is not cancelable.

I don't think there's an easy answer, you'll probably have to detect the 
problem and adjust the scrollposition yourself.

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
itdanny2002
Sent: Wednesday, November 26, 2008 6:13 AM
To: [email protected]
Subject: [flexcoders] PreventDefault doesn't work


An application with only 2 controls

ComponentA is a multi-line text.
ComponentB is TextInput.

I capture PgUp/PgDn and scroll the component.
However, when focus on component B, PgUp/PgDn
will cause my cursor move to the end or beginning
of word together with scrolling. I want to scroll
without moving the cursor in textInput.

I try to use preventDefault() but not success

private function KeyDown(event:KeyboardEvent):void{
if (event.KeyCode == KEYBOARD.PAGEUP) {
...... scroll the page......
}
}

private function ComponentAKeyDown(event:KeyboardEvent):void{
if (event.KeyCode == KEYBOARD.PAGEUP) {
event.preventDefault();
}
}

It works for other key, but not PgUp, PgDn !!

I try to override KeyDownHandler, not ok.

Any helps ?

Reply via email to