As a work around for now, I have changed the 'Enter' event handler to a 'dummy' method that starts a Timer for 100 milliseconds. The Timer's event handler is the 'real' Enter event handler. This is working, and the user doesn't notice the delay, but seems like a kludgey work around to me, and will be a real pain to implement for every field that we want to allow barcode entry for. Surely there is a better way....
Not exactly clear on your description of the problem. What do you mean the value is popped out?
Need a more clear description and then might be able to provide a more rational solution.
What I mean is that the 'Enter' is (or at least appears to be) triggering the 'Enter' event before the input that was entered before the 'Enter' button was 'pressed' by the barcode reader has made it into the control.
Say the barcode has 10 characters in it:
If the user manually enters the value and press enter, then texinput.text is always equal to GY00000001 when the 'Enter' event accesses the control
If the user uses the barcode reader to put the value in, then I get values like 'GY00', 'GY', 'GY0000' as the value in textinput.text when the 'Enter' event accesses the control. The actual value varies with each read, and about 1 time in 10 it will have the whole value. The screen display the user sees has the full value in it.
So - my working theory is that Flash/Flex is firing the 'Enter' event when the 'Enter' key is placed into the keyboard input buffer, not when the 'Enter' key is processed out of the keyboard input buffer, so when it is fired the remaining characters go on to be processed, but aren't available in the textinput.text property yet in the 'Enter' event. Normally this wouldn't be a problem because it would take a very fast user to actually get data into the buffer that fast. The barcode reader, however, IS that fast.
My theory seems to be confirmed, or at least plausible, since the workaround of having the 'Enter' event not do anything but fire off a Timer that waits 100 milliseconds, then calls the actual method I want to use to process the textinput.text value, has 'fixed' (I would say masked, but for the user it looks fixed) the problem.