Easy to embed, webcam based barcode scanner in flash.
Lately I have received quite a lot of emails about my barcode scanner. Most of these emails are by people requesting a ready to use version of the scanner. Apparently flash components are not so easy to use as I want them to be.
Therefore for anyone who wants to just put a working scanner on there website I suggest just using the following code:
As you might have noticed it loads the flash file from barcodepedia. The reason for this is that barcodepedia’s scanner will always be updated, such you do not have to update your files manually when a new version is released.
To controle the scanner it supports the following flashvars
- baseUrl - When a barcode is recognized the url specified here will be requested with the barcode attached.
- e1 - Error message given to the user when unsupported version of flash is found.
- e2 - Error message given to the user when no webcam is found.
- e2 - Error message given to the user when user disallows access to the webcam.
The below example and the above code both does a google search for the barcode, when one is scanned.
Example scanner
on February 12th, 2007 at 10:42 pm
thanks a lot for sharing this. I have often wanted something like this but haven’t really known where to start! Thank you very much.
on February 16th, 2007 at 2:58 pm
spooky, I just wondered about something like this in the last few days! Thanks very much for sharing :-)
on June 11th, 2007 at 2:07 pm
Hey, I get the idea, but how does it work?
on October 3rd, 2007 at 1:38 am
Hi, i tested it with Flash Lite 2.1 ( http://labs.adobe.com/wiki/index.php/Flash_Lite_2.1_Authoring)
on my Windows Mobile Smartphone with built in Webcam but i got a error that Flash 8 Content is not supported , and the code may be corrupted.
Using that Flash on my mobile would be very nice. ;-)
regards Oliver
on February 28th, 2008 at 2:02 am
I tried to use this but it just shows “loading” when it sees a barcode and doesn’t go to the site that I want it to go to.
on February 29th, 2008 at 3:37 pm
This app does not work! It only works on the barcodepedia site. Using it anywhere else including this site is not possible. If I copy the swf file to my own server, it automatically redirects to barcodepedia.
on March 4th, 2008 at 3:34 pm
Great, thanks!
Unfortunately, it does not seem to work here (Safari 3 browser or Camino), when a barcode is directed the flash app stays on “loading” but does not redirect me. Really odd, I can’t trace the root of this problem. Even tried copying as much as possible from barcodepedia itself:
http://www.dwizzy.nl/x/thingpedia.html
same result
on April 1st, 2008 at 3:50 pm
This is a great idea, Thanks for sharing! Do you have any resources for code that would enable me to DRAW barcodes (from a number) using either MAC or the iPhone SDK?
on April 24th, 2008 at 4:57 am
This doesn’t work with Flash 9. Apparently 9 doesn’t allow cross-domain redirects. The only solution I’ve found so far is downgrading to version 8.
on May 8th, 2008 at 3:20 am
Hey It works on my site but when it scans something it just says loading and does not do a Google search. Maybe you know how to remedy this? It does the same thing to me on this blog entry.
on May 10th, 2008 at 7:19 pm
OK, maybe I’m stupid, but how do you control where the baseUrl gets loaded? I tried reading the source, but I’m not a flash developer and can’t use the .fla file. When I try to scan a code on this page, the control shows “Loading” and seems to hang. When I scan over at barcodepedia.com, the content loads adjacent to the flash components. I tried reading the page source, but the DIVs are laid out funkily. Do I need something besides the EMBED tag? Thanks!
on May 18th, 2008 at 9:06 pm
I can embed it but when i scan the barcode it doesnt’t redirect me anywhere. Even the code copied directly from the barcodepidia website doesn’t work.
Can you email me back if you know of a fix please :D
on June 10th, 2008 at 8:03 pm
Hi, I tried your code, and somehow after scanning it will just displays “Loading” without actually going to google search… :(
on July 5th, 2008 at 8:52 am
Hello,
Thanks for this but I can’t get it to work. The camera comes up fine, but it doesnt read any barcode I try. I’ve tried it at various positions and black all around the bar code. How do you know if its working ? thanks.
on August 18th, 2008 at 10:12 am
The Flash application stuck after a code bar has been scanner (on Loading), i’m using firefox 3, there is any problems ?