flex:从swfloader加载的swf中截取屏幕截图 [英] flex: take screenshot from loaded swf from swfloader

查看:34
本文介绍了flex:从swfloader加载的swf中截取屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用 SWFLoader 类从加载的 swf 中保存屏幕截图吗?

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

推荐答案

如果加载的 swf 已经在 swfLoader 中处于所需状态,您应该可以这样做

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

这会将生成的屏幕截图添加到您的应用程序的显示列表中.当然,如果你想保存它,你可以把bitmapData 编码成PNG,例如.你可以找到很多这方面的教程.如果您使用的是 AIR,您可以简单地将其保存在用户的磁盘上.如果您的应用在网页上,您可能需要一些服务器端支持来保存图像.

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.

这篇关于flex:从swfloader加载的swf中截取屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆