entry count) Object End - 0x09 (preceded by an empty 16-bit string length) Strict Array - 0x0a (32-bit entry count) Date - 0x0b (Encoded as IEEE 64-bit double-precision floating point number with 16-bit integer time zone offset) Long String - 0x0c (32-bit integer string length with UTF-8 string) XML Document - 0x0f (32-bit integer string length with UTF-8 string) Typed Object - 0x10 (16-bit integer name length with UTF-8 name, followed by entries) Switch to AMF3 - 0x11 AMF objects begin with a (0x03) followed by a set of key-value pairs and end with a (0x09) as value (preceded by 0x00 0x00 as empty key entry). Keys are encoded as strings with the (0x02) 'type-definition' byte being implied (not included in the message). Values can be of any type including other objects and whole object graphs can be serialized in this way. Both object keys and strings are preceded by two bytes denoting their length in number of bytes. This means that strings are preceded by a total of three bytes which includes the 0x02 type byte. Null types only contain their type-definition (0x05). Numbers are encoded as double-precision floating point and are composed of eight bytes. As an example, when encoding the object below in actionscript 3 code. var person:Object = {name:'Mike', age:'30', alias:'Mike'}; var stream:ByteArray = new ByteArray(); stream.objectEncoding = ObjectEncoding.AMF0; // ByteArray defaults to AMF3 stream.writeObject(person); The data held in the ByteArray is: Note: the object properties can be sorted in a different order from the one in which they are placed in actionscript. For coloring/markup, refer to the legend below. The code above will work only for built-in classes like Object. To serialise and deserialise custom classes, the user needs to declare them using the registerClassAlias command or else an error will be thrown by the player. // for a hypothetical class Person registerClassAlias("personTypeAlias", Person); Although, strictly speaking, AMF is only a data encoding format, it is usually found encapsulated in a RTMP message or Flex RPC call. An example of the former can be found below (it is the "_result" message returned in response to the "connect" command sent from the flash client): legend: object start/end object keys object values ecma_array The AMF message starts with a 0x03 which denotes an RTMP packet with Header Type of 0, so 12 bytes are expected to follow. It is of Message Type 0x14, which denotes a command