Return to Snippet

Revision: 12939
at April 1, 2009 22:50 by publicbroadcast


Initial Code
/*

I DID NOT WRITE THIS, GO TO ACTIONSNIPPET.COM for this. IT IS A KICK ASS SITE.



*/


import com.adobe.images.JPGEncoder;
 
var jpgEncoder:JPGEncoder = new JPGEncoder(80);
var file:FileReference = new FileReference();
var id:int = 0;
 
var bit:BitmapData = new BitmapData(400, 400, false, 0x000000);
addChild(new Bitmap(bit));
 
stage.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void{
    // draw some perlin noise
    bit.perlinNoise(200,200, 2, Math.random()*100, true, false,0, true);
    //bit.draw(someClip);
    //bit.draw(someVideo);
    id++;
    file.save(jpgEncoder.encode(bit), "image_" +id+".jpg");
}

Initial URL
www.actionsnippet.com

Initial Description
This snippet uses the as3corelib which you can download on this page:
http://code.google.com/p/as3corelib/

Initial Title
Download an .jpeg onto your desktop

Initial Tags
actionscript, 3

Initial Language
ActionScript 3