Posted By

publicbroadcast on 04/01/09


Tagged

actionscript 3 wwwactionsnippetcom


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

nreliu
themill
mattlohmann
sultano
Pingpongbal
TrentSkunk
zoo
tspitzr


Download an .jpeg onto your desktop


 / Published in: ActionScript 3
 

URL: www.actionsnippet.com

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

  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. }

Report this snippet  

You need to login to post a comment.