4 Replies Latest reply on Nov 21, 2008 7:26 AM by *gsb*

    Read serie of digits from Barcode scanner

    ec30
      I'm writing an application in Flex to read a serie of digits from a barcode scanner and submit this to a PHP file in order to recieve a specific records (in XML) from a MySQL database.

      I'm looking for a robust solution to read a serie of digits (e.g. 2837821) from the keyboard (a barcode scanner just gives keyboard input) in an Flex. I found the following articles/posts:

      http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=304&produc tId=2&loc=en_US

      http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Act ionScript/Q_23609017.html

      I don't think a timedelay leads to a robust solution; many barcodes must be read in a batch. There must be a way to read a specified number of digits from the keyboard, and when this number of digits is reached (7) another function is executed to check the barcode?

      Another way maybe is to wait for an ENTER to be read from the keyboard, when ENTER is read, the previous serie of keyboard entries is checked.

      There must be some experienced Flex/Actionscript coders who can give me some guidelines in order to get a robust solution for this problem?
        • 1. Re: Read serie of digits from Barcode scanner
          *gsb* Level 1
          Bar code reader, at least the one I am familiar with, send a stream of seven (7) individual characters in rapid succession. I would assume that you have a form / TextInput filed to receive the bar code reader's input. If so, you would make a function that checks the "change" in the text field after each character arrives and if it is the seventh "valid" digit, make an http request sending the TextInput field's input data to your php application.
          • 2. Re: Read serie of digits from Barcode scanner
            ec30 Level 1
            Thank you Greg for your reply.

            This will be a solution which is functional and robust, however, for aesthetic reason I try to avoid a textInput field in the application. I there a way to use your approach without showing the input field on screen?
            • 3. Re: Read serie of digits from Barcode scanner
              ec30 Level 1
              Thank you Greg for your reply.

              This will be a solution which is functional and robust, however, for aesthetic reason I try to avoid a textInput field in the application. I there a way to use your approach without showing the input field on screen?
              • 4. Re: Read serie of digits from Barcode scanner
                *gsb* Level 1
                Make a 'global' listener for the keyboard I suspect.
                Look at, save and count contiguous digits.
                When you have collected 7 in a row, doSomething() with them and reset the collector to look for the next bar code.

                Greg