 package aerys.qark
 {
+	import flash.display.BitmapData;
 	import flash.utils.ByteArray;
+	import flash.utils.IExternalizable;
 	import flash.utils.describeType;
 	import flash.utils.getDefinitionByName;
 	import flash.utils.getQualifiedClassName;
 
 	public class Qark
 	{
-		private static const FLAG_OBJECT		: int		= 0;
-		private static const FLAG_ARRAY			: int		= 1;
-		private static const FLAG_INTEGER		: int		= 2;
-		private static const FLAG_FLOAT			: int		= 3;
-		private static const FLAG_STRING		: int		= 4;
-		private static const FLAG_UTF_STRING	: int		= 5;
-		private static const FLAG_BYTES			: int		= 6;
-		private static const FLAG_BOOLEAN		: int		= 7;
-		private static const FLAG_CUSTOM		: int		= 8;
-		
-		private static const ENCODERS		: Array		= [encodeObject,
+		private static const FLAG_CUSTOM		: int		= 0;
+		private static const FLAG_OBJECT		: int		= 1;
+		private static const FLAG_ARRAY			: int		= 2;
+		private static const FLAG_INTEGER		: int		= 3;
+		private static const FLAG_FLOAT			: int		= 4;
+		private static const FLAG_STRING		: int		= 5;
+		private static const FLAG_UTF_STRING	: int		= 6;
+		private static const FLAG_BYTES			: int		= 7;
+		private static const FLAG_BOOLEAN		: int		= 8;
+		private static const FLAG_BITMAP_DATA	: int		= 9;
+		
+		
+		private static const ENCODERS		: Array		= [encodeCustomObject,
+														   encodeObject,
 														   encodeArray,
 														   encodeInteger,
 														   encodeFloat,

														   encodeUTFString,
														   encodeBytes,
														   encodeBoolean,
														   encodeCustomObject];
		
		private static const DECODERS		: Array		= [decodeObject,
														   decodeArray,
														   decodeInteger,
														   decodeFloat,

		
		private static function encodeCustomObject(source : Object, target : ByteArray) : void
		{
			if (source is IExternalizable)
			{
				(source as IExternalizable).writeExternal(target);
			}
			else
			{
				var variables : XMLList = describeType(source).variable;
				var object	: Object = new Object();
				
				encodeString(getQualifiedClassName(source), target);
				
				for each (var variable : XML in variables)
				{
					var propertyName : String = variable.@name;
					
					object[propertyName] = source[propertyName];
				}
				
				encodeObject(object, target);
			}
		}
		
		private static function decodeCustomObject(source : ByteArray) : Object
