tags:

views:

248

answers:

1

hi. can i save a screenshot from a loaded swf using the SWFLoader class ?

+2  A: 

In case the loaded swf is already in a desired state in swfLoader, you should be able to do this

    var bitmapData:BitmapData =
        new BitmapData(swfLoader.content.width, swfLoader.content.height);
    bitmapData.draw(swfLoader);
    var bitmap:Bitmap = new Bitmap(bitmapData);
    var image:Image = new Image;
    image.source = bitmap;
    addChild(image);

This would add the resulting screen capture in the display list of your application. Of course, if you want to save it, you can take the bitmapData and encode it into PNG, for example. You can find plenty of tutorials for this. If you're using AIR you can simply save it on the user's disk. In case your app is on a web page, you probably need some server-side support for saving the image.

tehmou