Recently I was developing and AIR Application that utilized a barcode scanner. When the application loaded, the focus would be on a textinput and the user would scan a barcode to load a record. From there, I used the FlexEvent.ENTER ( enter attribute) to call my Actionscript function that did all the behind the scenes work. However, I found that when I attempted to access the String that the barcode was supposed to pass in (event.target.text), that it was only a partial string. It would work about 50% of the time, but it was a bug that had to be fixed.
I found that Adobe Flex/AIR had problems keeping up with the barcode scanner. Every time I scanned a barcode, it would read the carriage return and dispatch the enter event too early. This was causing the event to fire before the event.target.text attribute was fully set. After trying to solve this problem in my code, I determined that it might be the barcode reader’s settings. So, I picked up the manual and started reading.
I was using the Wasp WDI4500 2D Barcode scanner. There ended up being a setting called USB Keystroke Delay. By default, this setting was set to “No Delay”. All I had to do was scan the Medium Delay 20msec barcode to change the barcode setting. The manual was located in the PDF file that was on the disk included in the box. It was really that simple.
Hopefully this will help someone. I spent too much time trying to troubleshoot this through my code!