AS3 – QR Code Encoder
Very simple way to add QR codes to your AS3 projects.
To add QR codes to your project you can use this great library from Jean-Baptiste on GitHub.
In the code below you can switch in the various string variables to have the QR code either, display text, like to a website, send a text message or send an email.
package com.kafkaris.qrcodedemo
{
import org.qrcode.QRCode;
import flash.display.Bitmap;
import flash.display.Sprite;
public class QRCodeDSemo extends Sprite
{
private var _text:String = "Words from QR";
private var _website:String = "http://kafkaris.com";
private var _textMessage:String = "SMSTO:0410444555:Hello";
private var _email:String = "SMTP:jono@something.com:Hello:Message to Jono";
private var _qrImg:Bitmap;
public function QRCodeDSemo()
{
var qrObj:QRCode = new QRCode();
qrObj.encode(_website);
_qrImg = new Bitmap(qrObj.bitmapData);
_qrImg.width = _qrImg.height = 300;
addChild(_qrImg);
}
}
}
Thanks again to Jean-Baptiste.
JK.
No comments yet