flex: take screenshot from loaded swf from swfloader

孤街醉人 提交于 2019-12-10 12:08:42

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/1966428/flex-take-screenshot-from-loaded-swf-from-swfloader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!