Currently Reading

Image of Derivatives Demystified: A Step-by-Step Guide to Forwards, Futures, Swaps and Options (The Wiley Finance Series)

Image of Working Effectively with Legacy Code (Robert C Martin)

Image of Coders at Work: Reflections on the Craft of Programming

Image of Succeeding with Agile: Software Development Using Scrum (Addison-Wesley Signature)

Recently Read

Image of Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)

Image of The Secrets of Consulting: A Guide to Giving and Getting Advice Successfully

Image of ActionScript 3.0 Design Patterns: Object Oriented Programming Techniques (Adobe Developer Library)

Image of UML 2 for Dummies

Image of Test Driven: TDD and Acceptance TDD for Java Developers

Image of Cloud Atlas

Image of Test Driven Development (The Addison-Wesley Signature Series)

Image of Beginning iPhone 3 Development: Exploring the iPhone SDK

Image of Advanced Actionscript 3 with Design Patterns

Image of iPhone Advanced Projects (Books for Professionals by Professionals)


August 19, 2008

Creating Easy Application Icons

Filed under: ActionScript, Air — Anthony @ 10:14 pm

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();
}
 

2 Comments »

  1. Interesting, but what is “view” in bm.draw( view ); ?

    Comment by Jozsef — August 22, 2008 @ 3:14 pm

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

    Comment by Anthony — August 22, 2008 @ 8:06 pm

RSS feed for comments on this post. | TrackBack URI

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .