Quantcast
Channel: Designscripting
Viewing all articles
Browse latest Browse all 22

QR code generator in Flash AS3 using Google charts API

$
0
0

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

http://chart.apis.google.com/chart?chs=140×140&cht=qr&chld=L|0&chl=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{
						  	addChild(qrLoader);
						  })

Explanation for Actionscript used:

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

http://chart.apis.google.com/chart?chs=140×140&cht=qr&chld=L|0&chl=http://www.designscripting.com

Where,

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

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

Related posts:

  1. AS3 + Twitter interaction code snippets | Flash
  2. TinyUrl with actionscript 3.0 | Create TinyURL with as3
  3. Compare XML and Reload in AS3 + Twitter feed
  4. Fader-API + AS3
  5. Send / Pass values from Flash as3 to PHP without opening new window

Viewing all articles
Browse latest Browse all 22

Trending Articles