         }
 
         return array;
+    }
+
+    private static function decodeDictionary(xml:XML, context:AMFXContext):Dictionary
+    {
+        var dictionary:Dictionary = new Dictionary();
+
+        context.addObject(dictionary); // Remember the dictionary.
+
+        var entries:XMLList = xml.*;
+        if (entries == null)
+            return dictionary;
+
+        for (var i:uint = 0; i < entries.length(); i = i + 2)
+        {
+            var keyXml:XML = entries[i];
+            var valueXml:XML = entries[i + 1];
+            var key:Object= decodeValue(keyXml, context);
+            var value:Object = decodeValue(valueXml, context);
+            dictionary[key] = value;
+        }
+
+        return dictionary;
     }
 
     private static function decodeByteArray(xml:XML):ByteArray

        {
            result = decodeRef(xml, context);
        }
        else if (name == "double")
        {
            var n:String = xml.text().toString();


import flash.net.getClassByAlias;
import flash.utils.ByteArray;
import flash.utils.Dictionary;
import flash.utils.IExternalizable;
import flash.utils.getDefinitionByName;

import mx.logging.Log;
import mx.messaging.errors.ChannelError;
