Log in | Jump |

Flash Player roundup

Flash Flex Air FMS

This thing was constructed on February 7, 2009, and it was categorized as Adobe Flash, Adobe Flex.
You can follow comments through the RSS 2.0 feed. You can leave a comment, or trackback.

flash

By Jesse Warden:

Flash Player 10 comes with a nifty new method for theflash.net.FileReference class called “save“. What’s dope is that you can send it a ByteArray, and it’ll write it verbatim. This means, saving images out of your Flash & Flex Applications is wicked fast now AND gets around that lamesauce security restriction that plagued a lot of older Flash Player 9 code. In the past, you had to either upload the image, ask the server to convert/save a ByteArray/Base64 encoded string for you somewhere, which you would then download via FileReference.download. That code would fail in Flash Player 10 because you cannot initiate a download unless it’s via a mouse click.

The problem I’ve found is getting the image directly, meaning, without converting it or re-compressing it before saving. Here’s the 4 ways you can get an image into a ByteArray for saving:

  1. Use a Loader, and upon Event.COMPLETE, cast the the Loader.content as a Bitmap, and throw to a JPEGEncoder/PNGEncoder.
  2. Use a URLStream, and upon Event.COMPLETE, copy the bytes out into a new ByteArray.
  3. In Flex, use an mx:Image and repeat #1.
  4. In Flex, use Ely’s SuperImage, and repeat #1… or modify his class to expose the BitmapData it caches.

Read more at: http://jessewarden.com/2009/01/saving-images-out-of-flashflex-without-losing-quality.html

This thing was constructed by .


You can follow comments through the RSS 2.0 feed. You can leave a comment, or trackback.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*