Skip to content

AMF editor format

Jindra Petřík edited this page Nov 10, 2024 · 8 revisions

In FFDec you can edit data in AMF (Action Message Format) with Sol cookie editor or in PlaceObject 4 data field. There are two versions of this format, AMF0 and AMF3. FFDec uses JSON format for editing, which contains some special structures for Objects definition.

AMF0

Numbers

Same style as in ActionScript:

1, 2.5, 6e7

Boolean

Same style as in ActionScript:

true, false

String

Same style as in ActionScript:

"Hello world" with escaping using \ character like "That is \"so\" interesting".

\r for carriage return

\n for new line

\\ for backslash

\t for tab

Null

Same style as in ActionScript:

null

Undefined

ActionScript: undefined

FFDec editor:

{
  "type": "Undefined"
}

Anonymous object

ActionScript: {"a": 5, "b": true}

FFDec editor:

{
  "type": "Object",
  "members": {
    "a": 5,
    "b": true
  }
}

Ecma array type

ActionScript: [57, "hello", 21.5]

FFDec editor:

{
  "type": "EcmaArray",
  "members": {
    "0": 57,
    "1": "hello",
    "2": 21.5
  }
}

The array is always associative with string keys.

Strict array

ActionScript: ???

FFDec editor:

{
  "type": "Array",
  "values": [63, "hi!", 13.8]
}

This type is only for completeness. ActionScript never serializes this kind of type.

Date

ActionScript: new Date(2024,12-1,3,23,16,56,5)

FFDec editor:

{
  "type": "Date",
  "value": "2024-12-03 23:16:56.005",
  "timezone": -60
},

XML Document

ActionScript: new XMLDocument("<ul><li>item</li></ul>")

FFDec editor:

{
  "type": "XMLDocument",
  "data": "<ul><li>item</li></ul>"  
},

Typed object

ActionScript3:

package {
  public class MyClass {
    public var a:int;
    public var b:String;
  }
}
//...
import flash.net.registerClassAlias;

registerClassAlias("MyClassAlias", MyClass);

var value = new MyClass();
value.a = 7;
value.b = "okay";

FFDec editor:

{
  "type": "TypedObject",
  "className": "MyClassAlias"
  "members": {
    "a": 7,
    "b": "okay"
  }
}

Reference

If any complex object is serialized twice, the second time it is written as reference. These types can use references: Object, EcmaArray, Array, Date, XMLDocument, TypedObject. In FFDec editor, the first usage of the complex object is marked with "id" field, the reference then uses the same value in "referencedId" field.

ActionScript:

var myobj = {
  "a": 5,
  "b": "hello"
};
var value = {
  "x1": myobj,
  "x2": myobj
};
{
  "type": "Object",
  "members": {
    "x1": {
      "type": "Object",
      "id": "obj1",
      "members": {
        "a": 5,
        "b": "hello"
      }
    },
    "x2": {
      "type": "Reference",
      "referencedId": "obj1"
    }
}

References can be also circular.

AMF3

TODO...

Clone this wiki locally