Event.preventDefault?

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of aceoohay
Sent: Monday, August 18, 2008 4:46 PM
To: [email protected]
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