SWF FILE FORMAT SPECIFICATION
V
ERSION 19
Copyright © 2006-2012 Adobe Systems Incorporated. All rights reserved. This manual may not be copied,
photocopied, reproduced, translated, or converted to any electronic or machine-readable form in whole or in
part without written approval from Adobe Systems Incorporated. Notwithstanding the foregoing, a person
obtaining an electronic version of this manual from Adobe may print out one copy of this manual provided that
no part of this manual may be printed out, reproduced, distributed, resold, or transmitted for any other
purposes, including, without limitation, commercial purposes, such as selling copies of this documentation or
providing paid-for support services.
Trademarks
Adobe, ActionScript, Flash, Flash Media Server, Adobe Media Server, Flash Player, PostScript, and XMP are either
registered trademarks or trademarks of Adobe Systems Incorporated and may be registered in the United States
or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases
mentioned within this publication may be trademarks, service marks, or trade names of Adobe Systems
Incorporated or other entities and may be registered in certain jurisdictions including internationally. No right or
license is granted to any Adobe trademark.
Third-Party Information
This guide contains links to third-party websites that are not under the control of Adobe Systems Incorporated,
and Adobe Systems Incorporated is not responsible for the content on any linked site. If you access a third-party
website mentioned in this guide, then you do so at your own risk. Adobe Systems Incorporated provides these
links only as a convenience, and the inclusion of the link does not imply that Adobe Systems Incorporated
endorses or accepts any responsibility for the content on those third- party sites. No right, license or interest is
granted in any third party technology referenced in this guide.
NOTICE: THIS PUBLICATION AND THE INFORMATION HEREIN IS FURNISHED “AS IS”, IS SUBJECT TO CHANGE
WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR
INACCURACIES, MAKES NO WARRANTY OF ANY KIND (EXPRESS, IMPLIED, OR STATUTORY) WITH RESPECT TO
THIS PUBLICATION, AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR
PARTICULAR PURPOSES, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
Adobe Systems Incorporated - Published 2012
Contents
Introduction ............................................................................................................................................................. 12
Chapter 1: Basic Data Types .................................................................................................................................... 14
Coordinates and twips ......................................................................................................................................... 14
Integer types and byte order ............................................................................................................................... 14
Fixed-point numbers ........................................................................................................................................... 15
Floating-point numbers ....................................................................................................................................... 16
Encoded integers ................................................................................................................................................. 16
Bit values ............................................................................................................................................................. 17
Using bit values .................................................................................................................................................... 18
String values ........................................................................................................................................................ 19
Language code ..................................................................................................................................................... 20
RGB color record ................................................................................................................................................. 21
RGBA color with alpha record ............................................................................................................................. 21
ARGB color with alpha record ............................................................................................................................. 21
Rectangle record ................................................................................................................................................. 22
MATRIX record..................................................................................................................................................... 22
Color transform record ........................................................................................................................................ 24
Color transform with alpha record ...................................................................................................................... 25
Chapter 2: SWF Structure Summary
................................................................................................................. 27
The SWF header .................................................................................................................................................. 27
SWF file structure ................................................................................................................................................ 28
Tag format ........................................................................................................................................................... 29
Definition and control tags .................................................................................................................................. 29
Tag ordering in SWF files ..................................................................................................................................... 30
The dictionary ...................................................................................................................................................... 30
Processing a SWF file ........................................................................................................................................... 32
File compression strategy .................................................................................................................................... 32
Summary .............................................................................................................................................................. 32
Chapter 3: The Display List ...................................................................................................................................... 33
Clipping layers ..................................................................................................................................................... 33
Using the display list ............................................................................................................................................ 33
Display list tags .................................................................................................................................................... 34
PlaceObject ...................................................................................................................................................... 34
PlaceObject2 .................................................................................................................................................... 35
PlaceObject3 .................................................................................................................................................... 38
Color Matrix filter ............................................................................................................................................ 42
Convolution filter ............................................................................................................................................. 42
Blur filter .......................................................................................................................................................... 44
Drop Shadow filter........................................................................................................................................... 45
Glow filter ........................................................................................................................................................ 46
Bevel filter ....................................................................................................................................................... 46
Gradient Glow and Gradient Bevel filters ....................................................................................................... 47
ClipEventFlags .................................................................................................................................................. 48
RemoveObject ................................................................................................................................................. 50
RemoveObject2 ............................................................................................................................................... 50
ShowFrame ...................................................................................................................................................... 51
Chapter 4: Control Tags ........................................................................................................................................... 52
SetBackgroundColor ............................................................................................................................................ 52
FrameLabel .......................................................................................................................................................... 52
Protect ................................................................................................................................................................. 53
End ....................................................................................................................................................................... 53
ExportAssets ........................................................................................................................................................ 53
ImportAssets ........................................................................................................................................................ 54
EnableDebugger .................................................................................................................................................. 55
EnableDebugger2 ................................................................................................................................................ 55
ScriptLimits .......................................................................................................................................................... 56
SetTabIndex ......................................................................................................................................................... 56
FileAttributes ....................................................................................................................................................... 57
ImportAssets2...................................................................................................................................................... 58
SymbolClass ......................................................................................................................................................... 59
Metadata ............................................................................................................................................................. 59
DefineScalingGrid ................................................................................................................................................ 60
DefineSceneAndFrameLabelData ........................................................................................................................ 62
Chapter 5: Actions ................................................................................................................................................... 63
SWF 3 action model ............................................................................................................................................. 63
SWF 3 actions .................................................................................................................................................. 64
SWF 4 action model ............................................................................................................................................. 67
The program counter ....................................................................................................................................... 68
SWF 4 actions .................................................................................................................................................. 68
SWF 5 action model ............................................................................................................................................. 89
SWF 5 actions .................................................................................................................................................. 89
ScriptObject actions ......................................................................................................................................... 90
Type actions ................................................................................................................................................... 100
Math actions .................................................................................................................................................. 102