keyDown is not cancelable.

 

Post a test case so we can see how you wired it up.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of aceoohay
Sent: Monday, August 18, 2008 3:01 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Keydownhandler fires twice for each keystroke

 

nope...

After you posted I inserted;

event.preventDefault();

At the beginning of the function with no effect.

Like I said it seems as though the keyDownHandler function is called 
twice for each keystroke.

Paul
--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> 
wrote:
>
> Event.preventDefault?
> 
> Tracy
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of aceoohay
> Sent: Monday, August 18, 2008 4:46 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Keydownhandler fires twice for each keystroke
> 
> 
> 
> Flex 2.0.1
> 
> I am trying to capture keystrokes in the keyDownHandler of a 
> ComboBox and it appears to be firing twice for each keystroke.
> 
> Any ideas on what might cause this?
> 
> The code below works except that when the user strikes a 
<backSpace> 
> it removes two characters from _typedText.
> 
> Paul
> 
> override protected function textInput_changeHandler
> (event:Event):void
> {
> _typedText += this.textInput.text;
> if (!findFirstItem(_typedText))
> {
> _typedText = _typedText.substr
> (0,_typedText.length -1);
> findFirstItem(_typedText);
> }
> }
> override protected function keyDownHandler
> (event:KeyboardEvent):void
> {
> if(!event.ctrlKey)
> {
> if (event.keyCode == 
> Keyboard.BACKSPACE || event.keyCode == Keyboard.DELETE)
> {
> _typedText = 
> _typedText.substr(0,_typedText.length -1);
> findFirstItem(_typedText);
> }
> }
> }
>

 

Reply via email to