Hi Asim,
There are couple of methods by which you can do it.
You can try the following code in which i have captured the screen
shot of a panel.
private function saveAsImage():void
{
var bmpd:BitmapData = new
BitmapData(myPanel.width,myPanel.height);
bmpd.draw(myPanel);
var str:String=new String();
str="snapshot1.jpg";
var jpgenc:JPEGEncoder = new JPEGEncoder(80);
//encode the bitmapdata object and keep the encoded
ByteArray
var imgByteArray:ByteArray = jpgenc.encode(bmpd);
var fl:File = File.desktopDirectory.resolvePath(str);
var fs:FileStream = new FileStream();
//Method 2
//var snapshot:ImageSnapshot =
ImageSnapshot.captureImage(myChart);
//fs.writeBytes(snapshot.data, 0, snapshot.data.length);
try
{
fs.open(fl,FileMode.WRITE);
fs.writeBytes(imgByteArray);
fs.close();
Alert.show('Please see the desktop for '+str);
}
catch(e:Error)
{
trace(e.message);
Alert.show('Sorry Could not save the file');
}
}
~Yuvaraj
On Oct 14, 4:23 pm, Aasim <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can anyone plz share (code/tips) how to take desktop or application
> screenshots from AIR?
>
> -Aasim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---