如何触发 Flash 中静态文件的保存对话框?有问题的文件可以是本地的或远程的,如果这更容易的话。在这种情况下,文件是静态图像。
我是 AS(和 SO)的新手,但对于一个最初看起来非常简单的问题的解决方案是多么多样和复杂感到惊讶。
我在 JPEGEncoder(以及 ByteArray、BitmapData 等)方面取得了成功,但它非常慢,而且显然与文件类型无关。
我使用的是 Flash Pro CS5 而不是Flex 或 AIR。
如何触发 Flash 中静态文件的保存对话框?有问题的文件可以是本地的或远程的,如果这更容易的话。在这种情况下,文件是静态图像。
我是 AS(和 SO)的新手,但对于一个最初看起来非常简单的问题的解决方案是多么多样和复杂感到惊讶。
我在 JPEGEncoder(以及 ByteArray、BitmapData 等)方面取得了成功,但它非常慢,而且显然与文件类型无关。
我使用的是 Flash Pro CS5 而不是Flex 或 AIR。
您可以查看以下内容: http: //ask.amoeba.co.in/save-images-from-flash-actionsctipt-3-filereference-save-jpgencoder/
How do I trigger a save dialog for a static file in Flash?
If I understood your question correctly the answer is that you cannot touch any stuff on your computer on flash.
I've had success with JPEGEncoder (along with ByteArray, BitmapData etc.) but it's extremely slow
I've asked about that what is the simpliest way to get jpg from bitmapData
Adam Smith adviced to use faster alchemy based solution instead of JPEGEncoder: http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/
FileReference
您可以使用以下类通过 Flash 保存文件:http: //help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html
至于编码,JPEGEncoder
由于质量设置,可能会很慢。将其设置为 100% 应该会加快速度。PNGEncoder
不过更快,或者使用 Eugeny89 提出的基于炼金术的解决方案