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














Interesting, but what is “view” in bm.draw( view ); ?
Comment by Jozsef — August 22, 2008 @ 3:14 pm
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