The Contents stream is the document itself: which release saved it, the
scenes in order, the library, a record for every imported bitmap and sound, the colours,
the frame rate and the publish settings. The timelines are in their own streams, and
Contents is what names them. It is an
MFC archive, little-endian, with UTF-16
strings.
The layout below follows the JPEXS FLA converter, which writes these streams. The start of the stream, the scene records, the media records and the publish settings were checked against real files; the order of the later fields was not.
Document revision
The first byte of the stream is the document revision. It names the release that last saved the document, and it is how the explorer tells this format from the Flash MX and earlier one.
| Revision | Release |
|---|---|
0x38 | Flash MX 2004 |
0x3F | Flash 8 |
0x43 | Flash CS3 |
0x47 | Flash CS4, and the Save as CS4 option of later releases |
Fields that later releases added to Contents are present when the
revision is at least the value given below.
Layout
| Field | Present from | Meaning |
|---|---|---|
| u8 | always | The document revision. |
| u32 | 0x20 | 1 in the Flash MX 2004 and Flash 8 files seen, 0 in the CS3 and CS4 files; meaning not established. |
| u32 | always | The number of embedded OLE items; 0 in every file seen. |
| u8 | 0x14 | Not established. |
| u8 | 0x15 | Not established. |
| 4 bytes | 0x21 | Not established. |
| 4 bytes | 0x2B | Not established. |
| 4 bytes | 0x3B | Not established: Flash 8 and later. |
| 4 bytes | 0x40 | Not established: Flash CS3 and later. |
| 4 bytes | 0x44 | Not established: Flash CS4. |
| objects | always | The scenes, one CDocumentPage each, in order, ended by 00 00. |
| … | Then, in JPEXS’s order: the next scene number, the library, the media records, the grid, the print settings, the background colour, the frame rate as a 16.16 fixed-point number, the publish settings, the colour swatches, the library folders, the fonts and more. |
00000000 3F 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000010 00 00 00 00 00 00 00 FF FF 01 00 0D 00 43 44 6F .............CDo
00000020 63 75 6D 65 6E 74 50 61 67 65 17 06 50 00 61 00 cumentPage..P.a.
00000030 67 00 65 00 20 00 31 00 FF FE FF 07 53 00 63 00 g.e. .1.....S.c.
Contents stream of a Flash 8 document3F– document revision0x3F: Flash 801 00 00 00– the u32 present from revision0x20: 100 00 00 00– no embedded OLE items- 14 zero bytes – the two bytes of revisions
0x14and0x15, then the 4 bytes of each of0x21,0x2Band0x3B; Flash 8 is below0x40 FF FF 01 00 0D 00 "CDocumentPage"– the first scene, an object of a new class17– the scene record’s revision,0x1706and 12 bytes – the stream namePage 1: 6 characters of UTF-16LE, no markerFF FE FF 07and 14 bytes – the scene’s nameScene 1, a Unicode CString
Scene records
Each scene is a CDocumentPage object:
| Field | Meaning |
|---|---|
| u8 revision | 0x16 in Flash MX 2004, 0x17 in Flash 8, 0x18 in CS3, 0x19 in CS4; all seen in files. |
| Stream name | A length byte, the number of characters, then UTF-16LE with no marker: Page 1, or in Flash CS4 P 1 1227523356. |
| Display name | A Unicode CString: the scene’s name as the user sees it, Scene 1. |
| … | Further fields by revision. |
Media records
Each Media stream has a record in Contents, of class
CMediaBits for a bitmap. It has the same start as a scene record, then
the file the media was imported from:
| Field | Meaning |
|---|---|
| u8 revision | The record’s revision. |
| Stream name | A length byte, then UTF-16LE: Media 13, or in Flash CS4 M 13 … with a time stamp. |
| Display name | A Unicode CString: the item’s name in the library. |
| Source path | A Unicode CString: the path of the imported file, such as .\b\020000.gif. |
| … | Further fields: for sounds, the sample rate and format. |
For a sound, the rate is given as a tag; Ed Moore’s notes give 0x0A for
22,050 Hz, 0x0E for 44,100 Hz and 0x0F for 44,100 Hz stereo.
The media data itself is described in Bitmaps
and sounds.
Publish settings
The settings of the Publish Settings dialog are kept as pairs of CStrings, a key and a
value, both as text. The key names a group and a setting, joined by
::. A Flash 8 document, for example, holds keys such as
PublishFormatProperties::htmlFileName (game.html),
PublishProfileProperties::name (Flash 8 Settings) and
Vector::Debugging Permitted (0). The ones that matter most to
a reader:
| Key | Example value | Meaning |
|---|---|---|
PublishFormatProperties::flashFileName | game.swf | The name of the SWF file to publish. |
Vector::Version | 6 | The Flash Player version the SWF is made for. |
Vector::Compress Movie | Whether the SWF is compressed. | |
Vector::ActionScriptVersion | 1 | The ActionScript version the scripts are compiled as: 1, 2 or, from CS3, 3. |
Vector::DocumentClass | AvatarChat | Flash CS3 and CS4: the ActionScript 3.0 document class, found as an .as file on the class path. |
Vector::AS3 Package Paths | Flash CS3 and CS4: the class path for ActionScript 3.0 source. | |
Vector::AS3 Library Paths | Flash CS3 and CS4: the folders and SWC libraries to link. |
The explorer lists every pair it finds in a Publish settings table, and shows the SWF’s name, the target Flash Player version, the ActionScript version and the document class in its Document section. See classes and the document class.