I am having an issue where I show an AlertBox message when the user hits ENTER and the focus is in a text area. The pop up works fine, but when the user hits enter the Alert closes as expected, but the TextArea listener receives the ENTER event from the Alert and pops the dialog up again. I have tried a number of ways to catch and eat the event but so far I have not been lucky. Is there way to accomplish this?
public function init():void
{
myTextInput.addEventListener(KeyboardEvent.KEY_UP, handleKeyStrokes);
}
public function handleKeyStrokes(evt:KeyboardEvent):void
{
if(evt.keyCode == Keyboard.ENTER)
{
myAlert = Alert.show("This is a test and only a test", "Title", 4, null, alertCallBack);
}
}
<mx:TextInput id="myTextInput"
left="600" top="10">
</mx:TextInput>