SWF File Structure
SWF file structure
Following the header is a series of tagged data blocks. All tags share a common format, so any
PROGRAM PARSING A SWF File Can Skip over Blocks It Does Not Understand. Data INSIDE The Block Can
Point To Offsets Within The Block, But Can Never Point To an offset in another block. This enables
Tower To Be Removed, Inserted, or Modified by Tools That Process A SWF file.
About the file head is some tagged data blocks. All labels are in a general format. So any program can skip those still unclear blocks when parsing a SWF file. The data in each block can point to the offset in this block, but must not point to the offset of another block. This way, when you use the tool to process the SWF file, you can delete, insert, and modify (while the SWF file will not be damaged).
Tag Format
Label format
Each Tag Begins with a Tag Type And a Length. There Are Tag Header Formats, Short and long.
Short Tag Headers Are Used for tags with 62 bytes of data or less. Long tag headers can be used for
Any Tag Size Up to 4GB, Far Larger Than Is Presentfully Practical.
Each tag begins with a tag type and length. There are two, short and long. Short tag heads are used in tags that do not exceed 62 bytes of data; long tagbars can be used in any label than that of the actual size of 4GB.
Label head (short)
Field
Types of
Note
TagcodeandLength 16-bit
High 10 digits: tag type
Low 6 digits: label length
Note: The tagcodendlength Field Is A Two-byte Word, Not a bitfield of 10 Bits Followed by a bitfield
The Little-Endian Byte Order of Swf Makes These Two Layouts Different.
The Length Specified in The TagcodeAndlength Field Does Not Include The Recordheader
That Starts a tag.
The TagcodeAndLength field is a word, instead of a 10-bit binary field followed by a 6-digit binary field.
If the tag is 63 bytes or lonning, it is stored in a long tag header. The long tag header consists of a
Short Tag Header with aleth of 0x
3F
Followed by a 32-bit length.
If the label is 63 bytes or longer, it has a long label head. Long label heads seem to be 0x
3F
The short label head at the beginning, followed by a 32-bit length.
Label head (long)
Field
Types of
Note
TagcodeandLength 16-bit
Label type and label length (here the label length is not true) together is 0x3f
Packaging like a short label head
32 in length
Label length
Definition and Control Tags
Definition type tag and control tag
There Are Two Categories of Tags in SWF:
Definition tags these tags definition Tags these tags definition the content of the swf movie - the shapes, text, bitmaps,
Sounds, and so on. Each definition tag assigns a unique ID called a character id to the content it
Defines. Flase PLAYER THEN Stores The Character in a repository caled the dictionary. definition
Tags, by Themselves, Do Not Cause Anything to Be Rendered.
Control tags these tags create and manipulate rendered instances of characters in the
Dictionary, And Control The Flow of the Movie.
SWF has two types of types of tags:
Definition Tags: This type of tag defines the content of the SWF movie, such as various shapes, text, bitmaps, sound, and more. Each defined tag is assigned a single identification number to it, which is called a character ID. The .flash player puts these characters in a storage space, this storage us generally calls its dictionary. The definition TAG does not draw any graphics without any animation.
Control Tags: This type of label is used to generate rendering of role instances in the dictionary, and control the flow of the movie.
Tag Ordering in SWF
Sword of SWF tag
General Speaking, Tags in A SWF CAN Occur in Any ORDER. HOWEVER, THERE ARE A FEW Rules That
Must be observed:
1
A
Tag Should Only Depend On Tags Tag SHOULD NEVER Depend On A Tag That
Comees later in the file.
2
A
Definition Tag That Defines a Character Must Occur Before Any Control Tag That Refers To That
CHARACTER.
3 Streaming Sound Tags Must Be in Order. Out-of-Order Streaming Sound Tags Will Result In The
Sound Being Played Out of ORDER.
4 The end tag is always the laast tag in the swf file.
In general, the label can appear any cases, but it is not casual, it follows some rules: 1. A tab can only rely on labels before it, can not rely on labels after it. 2. One Defining the defined tab of the role must be before reference to the control type of the role. 3. The streaming media label must be in order, and there is no order of streaming. It is also no order 4. End Tag (TAG) should be at the end of the SWF file. (This article is declined, welcome to correct the error, ^ _ ^)