Every bitmap or sound imported into the library is kept in a
Media stream of its
own. Unlike the other streams, a Media stream is not an archive of objects: it is the
data itself. What the item is called, and the file it came from, are in its
media record in
Contents. No thumbnail or preview image was found in any binary FLA.
JPEG
A Media stream that starts FF D8 is a JPEG file, kept whole as it was
imported. Reading the stream gives a file that any image program opens. The explorer
shows it.
Lossless bitmaps
Bitmaps that are not JPEGs are kept in Flash’s own lossless form: a short header, then a zlib stream split into chunks. Little-endian throughout.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 2 | Signature | 03 05 |
| 2 | 2 | Row size | Bytes per row: the width × 4. |
| 4 | 2 | Width | In pixels. |
| 6 | 2 | Height | In pixels. |
| 8 | 4 | Left | The bounds, in twips (1/20 pixel): 0. |
| 12 | 4 | Right | The width × 20. |
| 16 | 4 | Top | 0. |
| 20 | 4 | Bottom | The height × 20. |
| 24 | 1 | Flags | Bit 0: the bitmap has transparency. |
| 25 | 1 | Variant | 1: zlib data in chunks, as below. |
| 26 | … | Chunks | Each a u16 length and that many bytes, until a length of 0. |
To decode it:
- Join the chunks in order. The result is one zlib stream; it starts with the zlib
header, often
78 01. - Inflate it to row size × height bytes.
- Read the rows, four bytes a pixel.
03 05 A4 00 29 00 A0 01 00 00 00 00 34 03 00 00 00 00 00 00 80 20 00 00 00 01 02 00 78 01 …
78 01, the zlib headerThe same format is used for the .dat bitmaps of the later XFL documents.
There, decoding a bitmap beside the PNG it was imported from showed four bytes a pixel
in the order alpha, red, green, blue, with the colours premultiplied by alpha (colour ×
alpha ÷ 256). The explorer decodes Media streams the same way. That the order is the
same in binary FLAs is an assumption: Kreijstal’s notes give alpha, blue, green, red
for Media streams, and neither has been checked against a source image here.
Sounds
An imported sound is kept as raw 16-bit PCM samples or as MP3 frames. The stream has
no header of its own: the sample rate and format are in the sound’s media record in
Contents. Ed Moore’s notes give the rate tags 0x0A for
22,050 Hz, 0x0E for 44,100 Hz and 0x0F for 44,100 Hz stereo.
The explorer does not play or decode sounds; it shows the stream’s bytes.