Serializing BitmapData to ByteArray (AMF)

I wonder if it is possible to serialize an instance of BitmapData to ByteArray (I don’t want to convert it to anything, so, no JPEGEncoder / PNGEncoder etc).

For now it seems that when you serialize BitmapData using standard procedure, i.e. by registerClassAlias(“extendingBitmapDataClass”), I will only get an object with the reference to the resource, but not the resource itself, so, this may work inside one SWF but not between 2 SWFs.

Why do I need this:

  • imagine, Alchemy JPEGDecoder would write an instance of BitmapData class instead of spitting out the array of pixels…
  • or, a server script will create, again, an instance of BitmapData, and send a ready-to-use AS class, instead of an image. (Flash Player isn’t superfast to read downloaded images…), besides, so far the Flash client is a weak link, so the server script has a lot of “spare” time to do that stuff instead…