BetaDesigns( Blog ) Flex and Component Development

19Aug/082

Creating Easy Application Icons

Just a quick post mostly as a reminder to myself on how to easily create Icons for your Adobe AIR applications.
Once the application has finished Initializing i add a button to the main view. that calls a method called takeSnapShot( e : MouseEvent ); that writes the application out to the desktop as a PNG file.

 
private function takeSnapShot( e : MouseEvent ) : void
{
  var bm : BitmapData = new BitmapData( Capabilities.screenResolutionX,
Capabilities.screenResolutionY, true, 0x00FFFFFF );
 
       bm.draw( view );
 
	var ba : ByteArray;
	var pnge : PNGEncoder = new PNGEncoder( );
	     ba = pnge.encode( bm );
 
  var file : File = File.desktopDirectory.resolvePath( "SnapShot.png" );
  var filestream : FileStream = new FileStream( );
     filestream.open( file, FileMode.WRITE );
     filestream.writeBytes(ba);
     filestream.close();
}
 
Comments (2) Trackbacks (0)
  1. Interesting, but what is “view” in bm.draw( view ); ?

  2. Ahh sorry,
    Forgot to explain what that was.. I am currrently using a lot of pureMVC concepts and view is actually just a getter for the viewComponent in an application in this case the main stage..


Leave a comment

(required)

No trackbacks yet.