Top > Flash > SWF > spec > The_Display_List

The Display List

  • Displaying a frame of a SWF file is a three-stage process:
  • 1. Objects are defined with definition tags such as DefineShape, DefineSprite, and so on. Each object is given a unique ID called a character, and is stored in a repository called the dictionary.
  • 2. Selected characters are copied from the dictionary and placed on the display list, which is the list of the characters that will be displayed in the next frame.
  • 3. Once complete, the contents of the display list are rendered to the screen with ShowFrame.

...

Clipping layers

Using the display list

Display list tags

PlaceObject

  • The PlaceObject tag adds a character to the display list.
  • The CharacterId identifies the character to be added.
  • The Depth field specifies the stacking order of the character.
  • The Matrix field species the position, scale, and rotation of the character.
  • If the size of the PlaceObject tag exceeds the end of the transformation matrix, it is assumed that a ColorTransform field is appended to the record.
  • The ColorTransform field specifies a color effect (such as transparency) that is applied to the character. The same character can be added more than once to the display list with a different depth and transformation matrix.
  • NOTE (これ、何処からコピーした?)
    • If a character does not change from frame to frame, you do not need to replace the unchanged character after each frame.
  • NOTE
    • PlaceObject is rarely used in SWF 3 and later versions; it is superseded by PlaceObject2 and PlaceObject3.
  • The minimum file format version is SWF 1.
  • PlaceObject
    FieldTypeComment
    HeaderRECORDHEADERTag type = 4
    CharacterIdUI16ID of character to place
    DepthUI16Depth of character
    MatrixMATRIXTransform matrix data
    ColorTransform (optional)CXFORMColor transform data

PlaceObject2

  • The PlaceObject2 tag extends the functionality of the PlaceObject tag.
  • The PlaceObject2 tag can both add a character to the display list, and modify the attributes of a character that is already on the display list.
  • The PlaceObject2 tag changed slightly from SWF 4 to SWF 5.
  • In SWF 5, clip actions were added.
  • The tag begins with a group of flags that indicate which fields are present in the tag.
  • The optional fields are CharacterId, Matrix, ColorTransform, Ratio, ClipDepth, Name, and ClipActions.
  • The Depth field is the only field that is always required.
  • The depth value determines the stacking order of the character.
  • Characters with lower depth values are displayed underneath characters with higher depth values.
  • A depth value of 1 means the character is displayed at the bottom of the stack.
  • Any given depth can have only one character.
  • This means a character that is already on the display list can be identified by its depth alone (that is, a CharacterId is not required).
  • The PlaceFlagMove and PlaceFlagHasCharacter tags indicate whether a new character is being added to the display list, or a character already on the display list is being modified.
  • The meaning of the flags is as follows:
    ■ PlaceFlagMove = 0 and PlaceFlagHasCharacter = 1
  • A new character (with ID of CharacterId) is placed on the display list at the specified depth.
  • Other fields set the attributes of this new character.
    ■ PlaceFlagMove = 1 and PlaceFlagHasCharacter = 0
  • The character at the specified depth is modified.
  • Other fields modify the attributes of this character.
  • Because any given depth can have only one character, no CharacterId is required.
    ■ PlaceFlagMove = 1 and PlaceFlagHasCharacter = 1
  • The character at the specified Depth is removed, and a new character (with ID of CharacterId) is placed at that depth.
  • Other fields set the attributes of this new character.
  • For example, a character that is moved over a series of frames has PlaceFlagHasCharacter set in the first frame, and PlaceFlagMove set in subsequent frames.
  • The first frame places the new character at the desired depth, and sets the initial transformation matrix.
  • Subsequent frames replace the transformation matrix of the character at the desired depth.
  • The optional fields in PlaceObject2 have the following meaning:
  • ■ The CharacterId field specifies the character to be added to the display list.
    • CharacterId is used only when a new character is being added.
    • If a character that is already on the display list is being modified, the CharacterId field is absent.
  • ■ The Matrix field specifies the position, scale and rotation of the character being added or modified.
  • ■ The ColorTransform field specifies the color effect applied to the character being added or modified.
  • ■ The Ratio field specifies a morph ratio for the character being added or modified.
    • This field applies only to characters defined with DefineMorphShape, and controls how far the morph has progressed.
    • A ratio of zero displays the character at the start of the morph.
    • A ratio of 65535 displays the character at the end of the morph.
    • For values between zero and 65535 Flash Player interpolates between the start and end shapes, and displays an inbetween shape.
  • ■ The ClipDepth field specifies the top-most depth that will be masked by the character being added.
    • A ClipDepth of zero indicates that this is not a clipping character.
  • ■ The Name field specifies a name for the character being added or modified.
    • This field is typically used with sprite characters, and is used to identify the sprite for SetTarget actions.
    • It allows the main file (or other sprites) to perform actions inside the sprite (see “Sprites and Movie Clips” on page 231). ■ The ClipActions field, which is valid only for placing sprite characters, defines one or more event handlers to be invoked when certain events occur.
  • The minimum file format version is SWF 3.
    (以下、フィールド詳細)

PlaceObject3

ClipEventFlags

RemoveObject

RemoveObject2

ShowFrame


Reload   Diff   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes
Last-modified: Fri, 21 Aug 2009 00:50:05 JST (5362d)