Flex 4 does not dispatch keyboard events for ENTER key.
Here is the sample application that has got this issue:
protected function application1_keyUpHandler (event: KeyboardEvent):void
Alert.show ("Key up: " + event.keyCode);
<s:TextArea verticalCenter="0" horizontalCenter="0" width="200"/>
If you run this application and try typing anything in a TextArea you will get alerts with key codes. However, if you press ENTER (or ALT), you will get no alert.
I'm pretty sure the code above is right so that means there is a bug in latest nightly builds of SDK (i would swhitch to an older build if i knew which one does not have this bug).
Flex harUI wrote:
That's true, but in this case, I think the text editing code is eating ENTER key in order to prevent parents from seeing it and acting on it (like a submit button). We'll see if we can find a way around that.
You can get the ENTER key now by listening in capture phase.
Flex SDK Developer
Adobe Systems Inc.
The enter key isn't being disposed of by textedit, the attached example code works without error if you a- remove the alert box and b-set the focus to your text area on initialisation. I agree that pressing the enter key then calling a dialog box will result in the enter key being "gobbled up" as the enter key is overridden by the dialog box code.
I think the first suggestion should be to anyone don't use dialogboxes for testing code. If for some reason debugging isn't desirable instead of a trace statement a simple label can be used as a 'fake' trace.
Message was edited by: David_F57: I worded this wrong, imho there is no need for a work around, the textarea component works as it should. When intercepting 'system' keycodes there is a need to consider the effect of the intercept and code appropriately to that end.