AMF Format
There’s currently a lot going on in the “open source Flash community”:http://www.osflash.org. On reading the “wishlist”:http://osflash.org/doku.php?id=whishlist at osflash.org I noticed there’s still some stuff missing on the AMF format. I used the AMF format extensively with some applications I wrote a while back so I looked up my notes on the format. Perhaps they’ll be useful for completing the refence at “osflash.org”:http://osflash.org/doku.php?id=amf:
[*Flash AMF*]
Used for:
* Local Connection
* SOL
* Remoting
The folowing elements are defined within AMF:
|*Type*|*Tagbyte*|
|Number|0×00|
|Boolean|0×01|
|String|0×02|
|Object|0×03|
|Undefined|0×06|
|Reference|0×07|
|AssociativeArray|0×08|
|Array|0×0A|
|Date|0×0B|
|SimpleObject|0×0D|
|XML|0×0F|
|Class|0×10|
For terminating sequences, a byte with value 0×09 is used.
*Number: 0×00 B7 B6 … B0*
Numbers in AMF are 64 bit ‘Big Endian’. Windows works with little endians, so conversion is required.
*Boolean: 0×01 B0 (BOOL)*
BOOL is 0 for FALSE and 1 for TRUE
*String: 0×02 L0 L1 SMBSTRING*
L1+L2 is Big Endian, length of the string. String is in multibyte format, prefixed with a 2 byte Big Endian length specifier.
*Object: 0×03 [SMBSTRING AMFELEMENT ] 0×09*
An object contains zero or more AMF elements that are prefixed with a multibyte string that indicates the AMF elements identifyer within the object.
*Undefined: 0×06*
An undefined element consists of soley one byte with the value 0×06.
*Reference (TODO): 0×07 ?*
A reference refers to an array or object that stored somewhere before. It’s probably a mechanism that prevents
*Associative Array: 0×08 L3 L2 L1 L0 [SMBSTRING AMFELEMENT ] 0×09*
L0..L3 for a 32 bit number indicating the number of elements present in the array. The length of the array is followed by (length) AMF elements that are prefixed with a multibyte string (with a 2 byte length prefix) that indicates the AMF elements identifyer within the array.
*Array: 0×0A L3 L2 L1 L0 [ AMFELEMENT ]*
L0..L3 form a 32 bit Big Endian number indicating the number of elements present in the array. The size of the array is followed by (length) AMF elements. Note that this collection is NOT terminated using 0×09.
*Date: 0×0B T7 T6 .. T0 Z1 Z2*
T7 to T0 form a 64 bit Big Endian number that specifies the number of nanoseconds that have passed since 1/1/1970 0:00 to the specified time. This format is “UTC 1970”. Z1 an Z0 for a 16 bit Big Endian number indicating the indicated time’s timezone.
*SimpleObject: 0×0C ?*
To do – meaning unknown.
*XML: 0×0F LMBSTRING*
The multi-byte string is prefixed with a 32 bit Big Endian number, indicating the length of the multibytestring that follows.
*Class: 0×10 SMBSTRING [ SMBSTRING AMFELEMENT ] 0×09*
A class element is similar to an object element, but has a class name indentifyer string prefixed to the array of member elements.
*Element containers*
Currently AMF is used with SharedObjectsLocal (.sol) files, Local Connection and Flash Remoting.
*SOL file format*
Header:
“\0xBF\0”
S3 .. S0
“TCSO\0\4\0\0\0\0″
SMBSTRING
“\0\0\0\0”
[ SMBSTRING AMFELEMENT ]
S3 .. S0 forms a 32 bit Big Endian number indicating the size of the file. The small multibyte string reflects the name of the object shared in the file. The array that follows has pairs of name (SMBSTRING) – value pairs.
About this entry
You’re currently reading “AMF Format,” an entry on vanrijkom.org
- Published:
- Thursday, June 9th, 2005 at 11:39 am
- Author:
- Ryko
- Category:
- Flash
5 Comments
Jump to comment form | comments rss