如何使用ActionScript3 / PHP从swf导出映像? [英] How to export image from swf with ActionScript3/PHP?

查看:134
本文介绍了如何使用ActionScript3 / PHP从swf导出映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个比我更高级的人的另一件事;)



我正在开发一个简单的Flash应用程序来创建自己的徽章。完成创建后,将其保存为客户端计算机或数据库的映像将是非常好的,我还不确定。问题是从swf内容制作图片 - 我的意思不是整个内容,只是COA的一部分。我使用一些图像编码器和PHP在网络上发现了一些例子,但我不明白它是如何工作的。有没有人可以这样解释我的基本原理?我想让它尽可能的简单。

解决方案

首先,将图像(Sprite或MovieClip等)绘制到BitmapData :

  var b:BitmapData = new BitmapData(640,480,false,0xffffffff); 
b.draw(mcToBeSaved);

然后,使用例如 as3corelib 将BitmapData编码成PNG或JPG文件。

  var ba:ByteArray = PNGEncoder.encode(b); 

然后,对于Flash 10,您可以立即让用户将图像保存到文件,使用FileReference的保存方法。


i have another piece for more advanced guys than me ;)

I am developing a simple flash application to create your own coat of arms. When finished creating, it would be nice to save it as an image to a client's computer or to a database, i am not sure yet. The problem is making the image from swf content - i mean not the whole content, just a part of it, where the COA is. I have found some eamples on the web using some image encoders and PHP, but i cant't understand how it works. Could anybody be so kind to explain me the basic principles of this? I want to make it as simple as possible.

解决方案

First, draw the image (Sprite or MovieClip, etc) into a BitmapData:

var b: BitmapData = new BitmapData(640, 480, false, 0xffffffff); 
b.draw(mcToBeSaved);

Then, use e.g. as3corelib to encode the BitmapData into PNG or JPG files.

var ba: ByteArray = PNGEncoder.encode(b);

Then, for Flash 10, you can immediately get the user to save the image to a file, using FileReference's save method.

这篇关于如何使用ActionScript3 / PHP从swf导出映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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