Home » ActionScript 3.0, Flash CS5, Google

QR code generator in Flash AS3 using Google charts API

4 December 2012 No Comment
Share on Facebook

QR codes are seen every where from news magazine, website, web ads, commercial television advertisements. With the more usage of smart phones with IOS and Android OS capable have more apps available to decode QR codes with that we can easily open URL instead of typing the URL from news paper in mobile browser.

In this Flash action script tutorial we are going to see how to generate QR code in AS3 using Google chart API.

Tutorial difficulty:

  • Basic to Intermediate
  • Actionscript 3.0


AS3 qr generator code source 

QR Code generator in Flash AS3

Google has varities of web API for simplifying developer operations. Some of the API are

  • Google Data APIs
  • Ajax APIs
  • Ads APIs

Some of the Google Data APIs we mostly use are Google Apps, Google Analytics, Blogger, Google Base, Google Book Search, Google Calendar, Google Code Search, Google Earth, Google Spreadsheets, Google Notebook, and Picasa Web Albums.

We are going to use the Google chart API ( “http://chart.apis.google.com/” ) to pull the QR code for the URL we have passed. The QR code we are going to pull the particular URL is customizable to some extent. Few are discussed at end of the code.

Sample qr code in as3:

Below is a sample qr code for the URL:http://www.designscripting.com


Entire Code for QR code generator

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.Loader;

var qrLoader:Loader = new Loader();
qrLoader.load(new URLRequest("http://chart.apis.google.com/chart?chs=140x140&cht=qr&chld=L|0&chl=http://www.designscripting.com"))

qrLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void{

Explanation for Actionscript used:

Simple Loader instance to load the Google Chart API with following parameters.



chs=x Specifies the width and height
cht=qr Specifies a qr code
chl= The data to encode.

Also check Google Chart API – QR Code details for more information.


We don't share your email anywhere, grab our rss via feedburner