PNG Encoder and Save to File
import flash.utils.ByteArray;
import flash.display.Bitmap;
import flash.display.BitmapData;
// code by tonmoy 05/04/2011 // save png data
var bd:BitmapData = new BitmapData(canvas.width,canvas.height);
bd.draw(canvas);
//Now we convert the BitmapData object to a ByteArray encoded as a PNG:
var PNGEnc:PNGEncoder = new PNGEncoder();
var ba:ByteArray = PNGEnc.encode(bd);
// save into file
var file:File = new File();
file.addEventListener(ProgressEvent.PROGRESS,savingPng,false,0,true);
file.save(ba,"design.png");
//end tonmoy
http://www.blooddy.by/en/crypto/benchmark/
ReplyDelete