SWF Player Lifecycle Example

This section provides a SWF file example to demonstrate Flash Player lifecycle: build display list, show frame, update display list, wait, show frame, ...

With the understanding of how the SWF tag process flow is synchronized with the Flash Player's show frame timeline, now I can have easier time to read the dump from a SWF file generated by "swfdump".

Let's use the "frame.swf" generated earlier as an example. My notes are embedded in the output inside parentheses.

C:\herong>\local\swftools\swfdump frame.swf
[HEADER]  File version: 6
[HEADER]  File is zlib compressed. Ratio: 41%
[HEADER]  File size: 591
[HEADER]  Frame rate: 12.000000
          (Displays 12 frames per second)
          (Or wait for 0.08 seconds before display next frame)
[HEADER]  Frame count: 61
[HEADER]  Movie width: 150.00
[HEADER]  Movie height: 350.00

[009]   3 SETBACKGROUNDCOLOR (be/be/be)

[020]  76 DEFINESHAPE3 defines id 0001
          (Creates the green light shape in the dictionary as "0001")
[028]  13 NAMECHARACTER adds information to id 0001 "greenLight"
[038]  15 EXPORTASSETS
          exports 0001 as "greenLight"

[020]  76 DEFINESHAPE3 defines id 0002
          (Creates the yellow light shape in the dictionary as "0002")
[028]  14 NAMECHARACTER adds information to id 0002 "yellowLight"
[038]  16 EXPORTASSETS
          exports 0002 as "yellowLight"

[020]  76 DEFINESHAPE3 defines id 0003
          (Creates the red light shape in the dictionary as "0003")
[028]  11 NAMECHARACTER adds information to id 0003 "redLight"
[038]  13 EXPORTASSETS
          exports 0003 as "redLight"

[01a]  21 PLACEOBJECT2 places id 0001 at depth 0001 name "greenLight"
          (Create an instance of character "0001" in the display list)
          
[001]   0 SHOWFRAME 1-24 (00:00:00,000-00:00:01,917)
          (show frame 1 by rendering items in the display list,
             which only has one, instance of character "0001", 
             the green light shape)
          (wait until the timeline reaches 1/12 (or 0.083} seconds)
          (show frame 2 by rendering display list items again) 
          ...
          (wait until the timeline reaches 23/12 (or 1.917} seconds)
          (show frame 24 by rendering display list items again) 

[01c]   2 REMOVEOBJECT2 removes object from depth 0001
          (Remove the instance of "0001" from the display list)
[01a]  22 PLACEOBJECT2 places id 0002 at depth 0002 name "yellowLight"
          (Create an instance of character "0002" in the display list)

[001]   0 SHOWFRAME 25-36 (00:00:01,1000-00:00:02,917)
          (wait until the timeline reaches 24/12 (or 2.000} seconds)
          (show frame 25 by rendering items in the display list,
             which has a different item now, instance of charaacter
             "0002", the yellow light shape) 
          ...
          (wait until the timeline reaches 35/12 (or 2.917} seconds)
          (show frame 36 by rendering display list items again) 

[01c]   2 REMOVEOBJECT2 removes object from depth 0002
          (Remove the instance of "0002" from the display list)
[01a]  18 PLACEOBJECT2 places id 0003 at depth 0003 name "redLight"
          (Create an instance of character "0003" in the display list)

[001]   0 SHOWFRAME 37-60 (00:00:02,1000-00:00:04,917)
          (wait until the timeline reaches 36/12 (or 3.000} seconds)
          (show frame 37 by rendering items in the display list,
             which has a different item now, instance of charaacter
             "0003", the red light shape) 
          ...
          (wait until the timeline reaches 59/12 (or 4.917} seconds)
          (show frame 60 by rendering display list items again) 

[01c]   2 REMOVEOBJECT2 removes object from depth 0003
          (Remove the instance of "0003" from the display list)
[01a]  21 PLACEOBJECT2 places id 0001 at depth 0004 name "greenLight"
          (Create an instance of character "0001" in the display list)

[001]   0 SHOWFRAME 61 (00:00:04,1000)
          (wait until the timeline reaches 60/12 (or 5.000} seconds)
          (show frame 61 by rendering items in the display list,
             which has a different item now, instance of charaacter
             "0001", the green light shape) 

[000]   0 END

Some key SWF file tags used in this example are:

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

 SWFC Script to Generate Flash SWF Files

 ActionScript Embedded in SWFC Script

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Structure and Tags

SWF File Processing Rules

 Flash Player Lifecycle - Timeline and Frame Rate

 SWF Tag Process Flow - SHOWFRAME Synchronization

SWF Player Lifecycle Example

 Showing SWF Tag Details - "swfdump --full"

 Flash Player Supports Dynamic Actions

 Action Instruction Example - "GotoFrame"

 Creating Display Objects with Action Instructions

 More Action Instructions and Less SWF Tags

 SWF Files for Video and Audio Streams

 Outdated Tutorials

 References

 Full Version in PDF/EPUB