Read QR Code With QRCodeReader Open-Source AS3 Library

Barcode-icon QR(Quick Response) is a matrix code created by Japanese corporation Denso-Wave in 1994. QR code can store addresses and URLs be appeared in magazines, on signs, business cards and other that users might need information. Users with a camera phone equipped with the reader application can recognize QR code from image, and decode it to string quickly. For people who want to use QR Codes within the Flash environment, QRCodeReader should be a good solution, it is essentially an open source library in ActionScript 3 that recognizes and decodes any QR Code from any image source. with this library, you can easily integrate your own QR reader into your AS3 mobile application.

Source Code


Access QRCodeReader Repository to get full source code.

Main Classes


This library is made from 2 main Classes:

  1. GetQRimage Class recognizes QR Code from image.
  2. QRdecode Class decodes QR Code to string.

Usage


GetQRImage:

  1. // set DisplayObject contains a QR Code
  2. getQRimage = new GetQRimage(imageSrc); // imageSrc:DisplayObject(Sprite, Video, …)
  3. // run onQrImageReadComplete when the QR Code is found
  4. getQRimage.addEventListener(QRreaderEvent.QR_IMAGE_READ_COMPLETE, onQrImageReadComplete);
  5. // begin recognition. you may run this every frame when the image source is viewed by a webcam.
  6. getQRimage.process();
  7.  
  8. // invoked when QR Code is found
  9. function onQrImageReadComplete(e:QRreaderEvent):void{
  10. // e.data is a 2D bit array of QR Code
  11. }

The bit array of QR Code obtained by GetQRimage can be decode by QRdecode Class.

QRdecode:

  1. // set 2D bit array of QR Code
  2. qrDecode.setQR(e.data); // e:QRreaderEvent
  3. // run onQrDecodeComplete when decoding is complete
  4. qrDecode.addEventListener(QRdecoderEvent.QR_DECODE_COMPLETE, onQrDecodeComplete);
  5. // begin decoding
  6. qrDecode.startDecode();
  7.  
  8. // invoked when decoding is complete
  9. function onQrDecodeComplete(e: QRdecoderEvent):void{
  10. // e.data is the string decoded from QR Code
  11. }

You also can get a full sample source code from here and more details from here. Please notice, for running the sample code, you need to connect a webcam to your computer.

Read QR Code With QRCodeReader Open-Source AS3 Library

In additional


Author Kenichi UENO is a Japanese, QR Codes are common in Japan, where they are currently the most popular type of two dimensional codes. Moreover, most current Japanese mobile phones can read this code with their camera.

Google’s mobile Android operating system supports the use of QR codes by natively, and Nokia’s Symbian operating system is also provided with a barcode scanner, which is able to read QR Codes. You also can create a mobile code with a few simple clicks from nokie mobile codes.

In fact, not only in the mobile environment, it is interesting too that provide a box on your webpage where the user can hold their qr code up to their webcam and be able to see their qr code on the computer screen, and take a picture of their code and retrieve their text kind like what is happening in this link. :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • Technorati
  • StumbleUpon
  • Twitter
RSS Enjoy this Post? Subscribe to Ntt.cc

RSS Feed   RSS Feed     Email Feed  Email Feed Follow us Follow us
You can leave a response, or trackback from your own site.

3 Responses to “Read QR Code With QRCodeReader Open-Source AS3 Library”

  1. Good post, Here is a post I developed as part of a series titled The Internet of Things. It is surprising that QR codes have taken this long to reach America and be adopted by the advertising crowd. Apparently, they don’t know a good thing when they see it. Thanks for the AS3 development insight, I will pass on the link.

  2. lokker says:

    mm…useful for me , thanks

  3. Maciej says:

    Hello,
    is there a way to use that library in Flex 4?
    I’m new to Flex and I have no idea if this is going to work there…

Leave a Reply