Download an .jpeg onto your desktop


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. /*
  2.  
  3. I DID NOT WRITE THIS, GO TO ACTIONSNIPPET.COM for this. IT IS A KICK ASS SITE.
  4.  
  5.  
  6.  
  7. */
  8.  
  9.  
  10. import com.adobe.images.JPGEncoder;
  11.  
  12. var jpgEncoder:JPGEncoder = new JPGEncoder(80);
  13. var file:FileReference = new FileReference();
  14. var id:int = 0;
  15.  
  16. var bit:BitmapData = new BitmapData(400, 400, false, 0x000000);
  17. addChild(new Bitmap(bit));
  18.  
  19. stage.addEventListener(MouseEvent.CLICK, onClick);
  20. function onClick(evt:MouseEvent):void{
  21. // draw some perlin noise
  22. bit.perlinNoise(200,200, 2, Math.random()*100, true, false,0, true);
  23. //bit.draw(someClip);
  24. //bit.draw(someVideo);
  25. id++;
  26. file.save(jpgEncoder.encode(bit), "image_" +id+".jpg");
  27. }

URL: www.actionsnippet.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.