Every movie starts with a header of six fields. The first three, 8 bytes, are always the same size; the frame size is a bit-packed rectangle whose size depends on the numbers in it, so the frame rate, the frame count and the first tag move with it. With the usual 15-bit values the header is 21 bytes and the first tag starts at offset 0x15.
00000000 46 57 53 04 A3 11 00 00 78 00 05 5F 00 00 0F A0
00000010 00 00 1E 02 00
FWS, version 4, 4,515 bytes, a
550 × 400 pixel stage, 30 frames a second, two framesFields
| Offset | Size | Type | Name | Meaning |
|---|---|---|---|---|
| 0 | 3 | UI8[3] | Signature | FWS (46 57 53) |
| 3 | 1 | UI8 | Version | The SWF version, 1 to 5 |
| 4 | 4 | UI32 | FileLength | The length of the whole file in bytes, these 8 included |
| 8 | varies | RECT | FrameSize | The stage, in twips; 9 bytes with 15-bit values |
| after | 2 | UI16 (8.8) | FrameRate | Frames a second, 8.8 fixed point |
| after | 2 | UI16 | FrameCount | The number of frames on the main timeline |
The tags follow directly.
Signature
Three bytes, FWS (46 57 53). Every movie of SWF 1 to 5 is
uncompressed and starts this way.
Version
One byte: the SWF version, the Flash Player the movie was made for, from 1 to 5.
| Version | Player | Released | What it brought |
|---|---|---|---|
| 1 | FutureSplash Player, Flash Player 1 | 1996 | Shapes, bitmaps, fonts, static text, sounds, simple buttons |
| 2 | Flash Player 2 | June 1997 | Lossless bitmaps, JPEG with its own tables, more shape styles, button sounds and colour, Protect |
| 3 | Flash Player 3 | May 1998 | Frame actions (DoAction), sprites, PlaceObject2, alpha, morph shapes, DefineFont2, DefineButton2 |
| 4 | Flash Player 4 | June 1999 | Stack actions and variables, text fields (DefineEditText), MP3 sound |
| 5 | Flash Player 5 | August 2000 | ActionScript with objects and functions, clip actions, ExportAssets and ImportAssets, the debugger |
The versions table lists every version, with the authoring tools.
File length
A UI32: the length of the whole movie in bytes, the header included. It equals the
size of the file. In the example, A3 11 00 00 is 0x11A3, 4,515 bytes.
Frame size
A RECT: a 5-bit count
Nbits, then Xmin, Xmax, Ymin and
Ymax, each a signed Nbits-bit number, padded to a whole
byte. The values are in twips, 20 to a pixel. Xmin and
Ymin are normally 0, so Xmax and Ymax are the
stage’s width and height.
The example’s nine bytes 78 00 05 5F 00 00 0F A0 00, as bits:
01111 000000000000000 010101011111000 000000000000000 001111101000000 0000000
Nbits Xmin Xmax Ymin Ymax padding
15 0 11000 0 8000
Frame rate
Frames a second, as an unsigned 8.8 fixed-point number stored little-endian: the
first byte is the fraction in 256ths, the second the whole number. In the example
00 1E is 30.0; 00 0C would be 12.0. The player tries to show
frames at this rate.
Frame count
A UI16: the number of frames on the main timeline, which is the number of
ShowFrame tags in the
movie’s own tag run, not counting those inside sprites. In the example
02 00 is two frames.