Generate a swf file, Display list (top)

 

To display one frame, three steps are required.
1. Use the definition block to define objects such as DefineShape . Give each object a unique id mark and store it in the dictionary.
2. The selected objects will be copied from the dictionary to the display list , and these objects in the display list will be displayed in the next frame.
3. Once completed, it will be drawn on the screen by ShowFrame (a control tag ).

To assign a depth to each object in the actual list. The concept of depth and becoming is the same.

Well prepared enough, I can look at a complete example. When I encounter something that is not mentioned, I can come back and look through the document again.

Examples are in Appendix A of the style book .

000000 46 57 53 03 4F 00 00 00 78 00 05 5F 00 00 0F A0
000010 00 00 0C 01 00 43 02 FF FF FF BF 00 23 00 00 00
000020 01 00 70 FB 49 97 0D 0C 7D 50 00 01 14 00 00 00   start of the line, to have a background
000030 00 01 25 C9 92 0D 21  ED 48 87 65 30 3B 6D E1 D8 end color section is the Shape
000040 B4 00 00 86 06 06 01 00 01 00 00 40 00 00 00     of " "body" part 35bytes

The cyan text is the header , I now know that 46 57 53 is FWS , and   03 indicates that this is a file exported in flash3 format, and the file length is 0x4F =79 . Oh, strange! But remember that the byte order is liitle-endian , so you have to look at it upside down. Next is a RECT represented by a variable-length number . Variable-length numbers are annoying, and you have to break them into binary to analyze. Recalls RECT format is UB [5] and 4 Ge SB [Nbits] , it must first dismantle 5 Ge bits out. At this time, the windows calculator is really a good helper!

0x78 -> 0111 1000 five is 01111 -> 15 in decimal . Then there are 15 * 4+5 = 65 -bit variable-length numbers that are valid for this RECT . This means that I want to split ceil (65/8) = 9 Ge bytes out and see header following a frequency that Chen, a UI16 , so longer to make up the number 0 , the gray part.

0111 1000   0000 0000   0000 0101   0101 1111   0000 0000
0000 0000   0000 1111   1010 0000   0000 0000

Well, the color green is easily recognized Nbits, two red is 0 respectively Xmin and Ymin , two blue is Xmax and Ymax .

Next is the fixed-point number of 8.8 . 0C means 12.0 which is the frame frequency, and finally 01 00 means there is a frame in total.

This is a review, let’s take a look at tag 43 02 FF FF FF

The total length of the file is 79 , minus 21 of header This tag is almost pull short format. This judgment is logical, but it is wrong! The only way to determine the format of a tag is to split its first two bytes into bits , see what type it is, and pay attention to the byte order: little-endian . So: 0x0243 -> 0000 0010 0100 0011 . The red part is 9 . The length of this tag is represented by the black part, 3 bytes .

What does 9 mean? If it's not like reading through the document every time, it's better to find a reference . There is a link in my bookmark, there is an online one, although the version is a bit old. 9 is setBackgroundColor , and there is an RGB in the back, so exactly 3 bits : Look at the back, 0xFFFFFF is white. This is a definition block.

Guess you like

Origin blog.csdn.net/panpanloveruth/article/details/7041324