tags:

views:

62

answers:

2

Hello, working with Flex4 AIR app, using this component I get data from the barcode reader,

<s:TextInput id="barcode" enter="showBarcode()"/>

Then for handle the enter event, wich is automatically triggered when reader finishes its reading

private function showBarcode():void{
   Alert.show(barcode.text);
}

Ok, very simple. But my problem is: the text showed in the Alert Box is incomplete, it misses one or two digits (last) or it just shows the entire text in the TextInput component (correct view)

I already test my BC reader using the notepad, and it's fine.

I have tested same code using MX components in Flex3 web app, and there's no problem.

Some help will be appreciated.

Tnx

A: 

Instead of using "enter" try listening to the onKeyUp event.

You'll have to figure out the appropriate end of line character read in from the bar code scanner. But, just key in on that and do your alert that way; otherwise do nothing.

www.Flextras.com
I try your suggestion using keyUp="showBarcode(event)". The result is the same.I believe this could be a bug related to the input buffer, I don't know.Tnx
gustyaquino
Interesting. It is easy to believe an input buffer would be a factor here. Have you tried the mx:TextInput in the Flex 4 SDK?
www.Flextras.com
you'll actually want to do keyDown, not keyUp (think about holding down a key in the textInput). We use barcode scanners here on many machines (listening for ctrl-y, the first character on our barcodes, to trigger certain actions in barcodeManager that becomes part of the display list... all works perfectly).
jeremy.mooer
@flextras You're right.. I just switched to mx:TextInput in the Flex 4 SDK and now it works perfectly.. Thanks!This could be interesting for the development team..
gustyaquino
@Gusty Must be an oddity in the Spark TextInput. @Jeremy I'm wondering why keyDown or keyUp would fire when using a bar code reader at all. Techincally no keys were pressed. I'm guessing Flash Player can't tell where the input is coming from?
www.Flextras.com
@El Howser -- if it is a generic barcode scanner, it is a usb device that is recognized as a keyboard, complete with OS keyboard presses. There is a chance that the thing has an application that acts as a proxy to the system... but I believe 99% of the barcode scanners that have been made in the last 10 years act as keyboards.
jeremy.mooer
A: 

Is text at least displayed as you would expect in Spark TextInput by using the same workflow with barcode reader as shown in this video "Flash Nicey Nice With HID" http://www.youtube.com/watch?v=sEw0RB-Uj00 ?

Anyway, I do not think Adobe Flash player supports officially other HID devices rather then keyboard or mouse.

Thus I would not expect Adobe engineers to make Spark TextInput compliant with your barcode reader input any time soon.

JabbyPanda
Just an idea.Try to listen for "change" event for Spark TextInput and inside the event listener check if the last text character is Keyboard.ENTER symbol > this will signal that the whole text is read from the barcode reader.
JabbyPanda
@JabbyPanda The BC reader acts as a regular keyboard, works perfectly listening to the "enter" event on either mx:TextInput and s:TextInput, the problem is related to the input data of the Spark component only, it behaves strange, the same data displayed in the field isn't available (sometimes partially) for AS use immediately after any event occurs (enter, change, keyUp, ..). The MX component works as spected for this matter.
gustyaquino