是否有可能捕获屏幕并保存在ActionScript 3图像? [英] Is it possible to capture the screen and save the image in actionscript 3?

查看:139
本文介绍了是否有可能捕获屏幕并保存在ActionScript 3图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要捕获当前在我的应用程序中显示的内容,并将其保存为图像,是一个在本地运行的Flash应用程序,没有apache,只是一个带有AS3的Flash应用程序,这有可能吗?



在此先感谢。


$ b

我曾经见过很多使用Google搜索的解决方案,但都需要一个网络服务器,而且这个应用程序是作为桌面应用程序运行的。 b

将一些显示对象绘制到一个BitmapData(舞台,例如),如果必要的话裁剪(BitmapData :: draw的第二个参数将帮助你在这里)。然后,使用一些编码器将原始像素数据转换为JPEG或PNG。我肯定到了这一步,这就是这些教程将解释你如何做。



现在,第三步是不同的,但很简单。而不是将图像数据发送到服务器端脚本,请使用FileReference对象。从Flash Player 10开始,它有一个名为 save ,提示用户在本地保存文件。



由于这是一个桌面应用程序,因此您也可以将其设置为AIR应用程序。这样可以更直接地访问文件系统和其他功能,以防您需要。


I need to capture whats currently shown in my app and save it as a image, is a flash app running locally, without apache, just a flash app with AS3, is it possible?

Ive seen many solutions googling but all need a webserver and this app is running as a desktop app.

Thanks in advance.

解决方案

Yes, it's possible.

Draw some display object to a BitmapData (the stage, for example) and crop it if neccesary (the second param of BitmapData::draw will help you out here).

Then, convert the raw pixel data to JPEG or PNG using some encoder. I'm sure up to this point, this is what those tutorials will explain you how to do.

Now, the third step is different but simple enough. Instead of sending the image data to a server side script, use a FileReference object. Since Flash Player 10, it has a method called save, that prompts the user to save a file locally.

Since this is a desktop app, you could also make it an AIR app. This will give more direct access to the file system and other features, in case you need them.

这篇关于是否有可能捕获屏幕并保存在ActionScript 3图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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