Update: Paul Hinrichsen pointed me to a new implementation of a QRCode Reader (Adobe Native Extension) build by Sbhave. It works BRILLIANTLY and VERY fast. It is built for Flex but there is also a build for Flash CS6 which is easy to set up.
A native extension is really fast code (mostly c++, with a Actionscript API). More info in this discussion: http://forums.adobe.com/message/4699875
Google code project page: http://code.google.com/p/adobe-air-qr-barcode-zbar-ane/
QRcode reader implementation that uses the QRCode Reader by Logosware (Libspark project). Code is improved with Adaptive Threshold (by Quasimondo) and other small modifications to improve the QRcode detection.
- Implemented Adaptive Threshold by Quasimondo (Mario Klingemann) in the GetQRimage Class.
- Added the substract blur method that Mario Klingemann explains in his lecture about the
process of reading QR codes. I’ve got less wrong strings in this mode and the detection runs faster.
You can set it to false, to use the original method.
- The outside parts of the video are cropped, to reduce image noise. By providing a markerGuide
the user knows where to hold the marker.
- The data from the onQrDecodeComplete event is compared with the data from a previous event as
a way of extra error correction.
The user interface uses the minimalcomps by Keith Peters (bit-101) and the Hi-Res! stats by Mr. Doob.
Example (Flash Player 10 or higher)
Generate a QRcode and print it out.
- Introduction of QR Code Reader Library
- QRCodeReader library (Libspark)
- Automated Threshold & Edge Detection
Download : ReadQrSimple – source code
Download : ReadQrMobile – source code (version tested on Galaxy S2, by Paul Hinrichsen).
If you have suggestions for more improvements, please give your feedback in the comments.
28 thoughts on “Flash QRcode reader as3”
I just came across this and will actually give it a try over the weekend. Need to implement this over a project very soon, and this has actually given me hope ..
Awesome work! Got the source code last night and it’s running flawlessly right now. I’m really grateful for your hard work. Thank you!
I don’t have permission to download the source.
It should work now.
I adapted your project to FLEX4 and it’s working in preview mode but it doesn’t work in my Iphone after compiled.
No idea, never did a port to a mobile platform with this.
If you found anything interesting, please post it here or link to some information if you want.
Thans for this code, I am excited use it. However, I am having a probelm. I downloaded your source code and tried compiling it with mxmlc, however, I am getting an error in the AdaptiveThresholdFilter.as
“Error: The definition of base class ShaderFilter was not found. public class AdaptiveThresholdFilter extends ShaderFilter ”
Can you help me with this error?
You have to compile as Flash Player 10 or newer, since ShaderFilter is supported since FP10.
we have been trying to use this code, but until now it only shows the interface, without detecting the information from the QR code. It is not the webcam as it works fine on your page. Is it possible that you can send your fla file? Or do you have any suggestions what the problem is?
Build it with for Flash Player 10 or higher.
hey cristian :)
did you find a solution for the iphone? it would be nice if you could share your experience with us! (:
I have found that this works best if the subtract filter is turned off:
getQRimage = new GetQRimage(video, markerAreaRect, true, false);
Otherwise I get lots of incorrect data.
Thanks for the code. I have spent months and months trying to build a working QR Code reader and now have managed to do so with your code. I have it working on my Samsung Galaxy SII in AIR.
My ONLY issue is that it would be nice if I could increase the size of the capture area. It is very small on the phone and this makes capture a little difficult.
Changing camera size alone doesnt improve things (in fact makes it worse) and increasing markerArea = 200 also doesnt improve things.
Any hints would be greatly appreciated.
Maybe you can change the camera capture resolution. You can also scale the video object (and the overlay sprite object) if you want to have it fullscreen.
Maybe you can share your steps to publish it for the Galaxy SII also online. Would be nice since I lot of people are trying to figure that out.
Thanks, very useful!!!!
I have done as you suggestght. Its basically your code but works well on my Samsung Galaxy S2 but is sensitive to the light intensity. Too much or too little and it cant read.
How do I post my code here ?
Great that you could solve it. The adaptive threshold solved the light issues, so maybe you can find a non-pixelbender implementation of that one. For sure it is around.
I don’t know how you can post the code in this Disqus form, but if you send it to me by mail, I’ll put it on my website (or I can link to yours if you put it there of course).
Now that you have ..why is the download-link not working? – it just refreshes the page.
Thank you for the notification. It works now.
Hey guys. im new at flash.
Im doing this project for school.
im making a app and in this app i have a camera, and would like to have a QR code reader, so it can scan a QR code when using app.
I have downloaded the source code, but i dont know how to use it now.
what shall i copy to my flash fil.
plz help me.
Answer from Paul:
Hi to The_Albanian
Which code are you having trouble with – Kaspers or mine (Paul)?
If you download my code contained in the .zip file and unzip it to any folder you will find the MyQRreader.fla file. Open this in Flash (I used CS6 but it should work in any lower version as well).
Then since I ran the code on my Samsung Galaxy S2 (Android device) you need to compile it in the AIR for Android setting. OK – anything lower than Flash CS5.5 will not be able to run as AIR but you should be able to compile it in the Flash Player 10.3 settings but it will give two errors related to lines 240 and 60 of the .as file ReadQRSimple.as as therse lines are specific to Android devices.You can simply comment these lines out or delete them entirely. It will then run as pure Flash although your Quit button will probably not work and will need a bit of re-code as it currently uses native code to quit.
Running in Flash Player 10.3 you may find that you have lost the lower buttons but then simply resize the stage as the Android stage runs at 480 x 800 while (if memory serves me correctly) you may need to change stage size to 320 x 640 or something – sounds wrong but you get my point). If you re-size the stage and make it smaller then you will need to re-position the buttons code-wise.
I have not tested its read capabilities in Flash Player 10.3 but I see no reason why it should not work. Bare in mind that the code is not yet perfect and running on Android I do find that it seems not to read if the image is either too bright or too dull. I am experimenting with building Flash cameras at this stage and have built a camera where I have some degree of control over the exposure level of the image and may later try to re-build the camera in this code.
Hope this post is not too late for your school project but i fear it may be – SORRY !!
Feel free to post again if you need more help. I will keep my eye on this post.
Hey Paul i am having trouble with the ReadQrMobile, i have installed it on my s2 but the camera can not make out a image it is all distorted
nvm got it working just published it in gpu mode, but can’t read the QR Codes :(
Thanks for your code it has made my life much easier as I am trying to make a QR code reader, that then passes information obtained by the QR to a database…. However when I test the Application I keep getting the error “packages cannot be nested” can anyone help me???
Warning: Library path “$(FlexSDK)/frameworks/libs/flex.swc” does not resolve to a valid file.
Warning: Library path “$(FlexSDK)/frameworks/libs/core.swc” does not resolve to a valid file.
These two warnings sucks my head. I m beginner and unknown to Flash. Please somebody help me to get out of this. I just want to build a QR Reader Android App and trace the scanned QR value in Adobe AIR.
It’s Work fine for me, great code.
How to extend this to support BarCode (EAN_8, EAN_13 for example) for educationnal purpose.
No idea, I’m not using Flash anymore for these kind of purposes.