flash on 2011-9-10
as seen here
http://www.firefallthegame.com/community/members/chinadian.183503/
/**
* Copyright wh0 ( http://wonderfl.net/user/wh0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eKIv
*/
package {
import flash.geom.Matrix;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
import com.adobe.images.PNGEncoder;
public class FlashTest extends Sprite {
private var bd:BitmapData = new BitmapData(96, 96, false, 0x000000);
private var m:Matrix = new Matrix();
public function FlashTest() {
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, function (e:UncaughtErrorEvent):void { Wonderfl.log(e.error); });
graphics.beginFill(0x000000);
graphics.drawRect(0, 0, 465, 465);
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
l.load(new URLRequest('http://www.firefallthegame.com/community/styles/firefall/avatar_bg.png'), new LoaderContext(true));
var b:Bitmap = new Bitmap(bd);
b.x = 24; b.y = 26;
addChild(b);
m.translate(-70, -71);
m.scale(0.8, 0.8);
m.rotate(-0.1);
m.translate(70, 71);
m.translate(-24, -26);
}
private function complete(e:Event):void {
stage.quality = StageQuality.BEST;
e.target.loader.content.smoothing = true;
addChild(e.target.loader.content);
addEventListener(Event.ENTER_FRAME, frame);
stage.addEventListener(MouseEvent.CLICK, click);
}
private function frame(e:Event):void {
bd.draw(this, m, null, null, null, true);
}
private function click(e:MouseEvent):void {
new FileReference().save(PNGEncoder.encode(bd), 'foo.png');
}
}
}