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

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

问题描述

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

在swfLoader中所需的状态,你应该可以做到这一点。

$ b $ p $ bitmapData =
BitmapData .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,则可以将其保存在用户的磁盘上。如果您的应用程序在网页上,则可能需要一些服务器端的支持来保存图像。


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

解决方案

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.

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

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