我为比我更高级的人准备了另一件作品;)
i have another piece for more advanced guys than me ;)
我正在开发一个简单的 Flash 应用程序来创建您自己的徽章.创建完成后,最好将其作为图像保存到客户端的计算机或数据库中,我还不确定.问题是从 swf 内容制作图像 - 我的意思不是全部内容,只是其中的一部分,即 COA 所在的位置.我在网上找到了一些使用图像编码器和 PHP 的示例,但我不明白它是如何工作的.有人可以向我解释一下这个的基本原则吗?我想让它尽可能简单.
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.
推荐答案首先,将图像(Sprite或MovieClip等)绘制成BitmapData:
First, draw the image (Sprite or MovieClip, etc) into a BitmapData:
var b: BitmapData = new BitmapData(640, 480, false, 0xffffffff); b.draw(mcToBeSaved);然后,使用例如as3corelib 将 BitmapData 编码为 PNG 或 JPG 文件.
Then, use e.g. as3corelib to encode the BitmapData into PNG or JPG files.
var ba: ByteArray = PNGEncoder.encode(b);然后,对于 Flash 10,您可以立即让用户使用 FileReference 的 save 方法将图像保存到文件中.
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 导出图像?
发布评论