如何从SWF与ActionScript3的/ PHP输出图像? [英] How to export image from swf with ActionScript3/PHP?

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

问题描述

我有另一块为更高级的家伙比我;)

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

我开发一个简单的Flash应用程序来创建你自己的徽章。创建完,这将是很好把它保存为图像,以客户端的计算机或数据库,我不知道呢。问题是从SWF内容使得图像 - 我的意思不是全部内容,只是它的一部分,那里的COA是。我发现用一些图像连接codeRS和PHP在Web上的一些eamples,但我cant't了解它是如何工作的。可能有人会这么好心来解释我的这个基本原则是什么?我想让它尽可能的简单。

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.

推荐答案

首先,绘制图像(雪碧或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 以EN code这两个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的保存方法。

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

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

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