         return null; // it all checks out!
     }
 
+    // hope and pray that they don't revamp amf3 again and start using this byte. Assholes.
+    public static const DICTIONARY_MARKER :int = 99;
+
     /**
      * Our static initializer.
      */

    staticInit();

    /** Non-simple classes that we allow, as long as they are not subclassed. */
    protected static const VALID_CLASSES :Array = [ "flash.utils.ByteArray", "flash.geom.Point", "flash.geom.Rectangle" ];
}
}

            return dest;
        }


        var bytes :ByteArray = new ByteArray();
        bytes.endian = Endian.BIG_ENDIAN;
        bytes.objectEncoding = ObjectEncoding.AMF3;
        // FIX, Because adobe is FUCKING IT UP as usual.
        // It seems that with flash 10, they "enhanced" AMF3 encoding. That's great and all,
        // except when we try to send this data back to a flash 9 player, which can't read it.
        // Guess what, asshats? If you change the encoding spec, IT'S NOT THE SAME VERSION ANYMORE.
        // Thanks for breaking all our code where we explicitly set AMF3, even though
        // it's currently the default.
        if (obj is Dictionary) {
            var asArray :Array = [];
            for (var key :* in obj) {
                asArray.push(key);
                asArray.push(obj[key]);
            }
            obj = asArray;
            // then insert our special marker byte before writing this array
            bytes.writeByte(DICTIONARY_MARKER);
        }
        bytes.writeObject(obj);
        return bytes;
    }
