I'm doing a simple test. I want to write BitmapData into a ByteArray. I'm trying to do this with writeObject() and readObject(). Read object seems to have trouble making sense of the BitmapData.
var byteArray : ByteArray = new ByteArray();
var _cache : BitmapData = new BitmapData( 640, 480, true, 0x000000 );
var _blank : BitmapData = new BitmapData( 640, 480, true, 0x000000 );
byteArray.writeObject( _blank );
byteArray.position = 0;
_cache = byteArray.readObject() as BitmapData;
trace( _cache ); // Traces null
Can anyone clear this up for me? I can't make sense of what's going wrong with readObject();
I know I can do this getPixels() and setPixels(), but I'd like to treat the object as an object here.