code: function(value)
      {
          var result = {};
  
          var t = typeof(value);
          //primitives are kept as such
          if (t == "number" || t == "string" || t == "boolean" || t == null || t == undefined)
          {
              result = value;
          }
          else if (value instanceof Array)
          {
              //arrays are serializesd recursively
              result = [];
              for (var i = 0; i < value.length; i++)
              {
                  result[i] = this.serialize(value[i]);
              }
          }
          else if (t == "function")
          {
              //js functions are assigned an ID and stored in the local cache 
              result.type = FABridge.TYPE_JSFUNCTION;
              result.value = this.getFunctionID(value);
          }
          else if (value instanceof ASProxy)
          {
              result.type = FABridge.TYPE_ASINSTANCE;
              result.value = value.fb_instance_id;
          }
          else
          {
              result.type = FABridge.TYPE_ANONYMOUS;
              result.value = value;
          }
  
          return result;
      }
docs: serialization / deserialization