1 Reply Latest reply on Jan 30, 2007 9:28 AM by FlightGuy

    Create Image from String

      Anyone know how to create an image from a string (base64 encoded PNG image) using the Flash/Flex API?
        • 1. Re: Create Image from String
          FlightGuy Level 1
          Here's a really neat article on encoding a PNG from a BitmapData object using AS3. You could do the reverse of what he does in his example (more or less - depends which PNG chunks are used in your source data, and whether you need to accept PNG data from a variety of sources). Depending on where the data's coming from, you might consider changing it into a zlib compressed bitmap on the server, then use the ByteArray to uncompress it - then write it to a BitmapData object and display using Bitmap. To decode it, use the (undocumented) mx.utils.Base64Decoder class.

          If you do write a PNG decoder in AS3, post it here so we can all use it.