Trigger save dialog for a static file - Flash
How do I trigger a save dialog for a static file in Flash? The file in question can be local or remote, if that's easier. In this case the file is a static image.
I'm new to AS (and SO), but am astonished by how varied and convoluted the solutions are for a problem which initially seems very straightforward.
I've had success with JPEGEncoder (along with ByteArray, BitmapData etc.) but it's extremely slow and obviously not 开发者_如何学JAVAfile type agnostic.
I'm using Flash Pro CS5 and not Flex or AIR.
You can save a file through Flash using the FileReference
class: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html
As for encoding, the JPEGEncoder
can be quite slow due to the quality setting. Setting it to 100% should speed it up. PNGEncoder
is quicker though, or use the alchemy based solution proposed by Eugeny89
You may have a look on the following: 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/
精彩评论