QRCode
QRCode generator was now released, it generates a code with javascript by calling ExternalInterface.call(). First input a string into the textfield right below and press enter key to generate your code, that shows it in the left pane. You can download the source below.
Download : source
Anatomy the script
<script type="text/javascript" src="QRCode.js"></script> <script type="text/javascript"> var qr; function generate(str){ qr = new QRCode(4, QRErrorCorrectLevel.H); qr.addData(str); qr.make(); } function count(){ return qr.getModuleCount(); } function isDark(r, c){ return qr.isDark(r, c); } </script>
The isDark() method in a container can be invoked to make actionscript know the color of the dot for setting pixels with black and white in bimap to view.
ExternalInterface.call("generate", str); var count:Number = Number(ExternalInterface.call("count")); var bitmap:BitmapData = new BitmapData(width, height, true); this.createEmptyMovieClip("c", 1).attachBitmap(bitmap, 1); for(var r:Number = 0; r < count; r++){ for(var c:Number = 0; c < count; c++){ var col:Number = Number(ExternalInterface.call("isDark", r, c)) ? 0x00000000 : 0x00ffffff; bitmap.setPixel((width - count) / 2 + c, (height - count) / 2 + r, col); } }