Dumping Simple SWF Files

This section provides a tutorial example on how to dump and disassemble a simple SWF file with SWFTools package and Flex SDK package.

To compare the SWF file dumper tool from the SWFTools package and the SWF file disassembler tool from the Flex SDK package, let's look at a simple Flash application written in SWFC script, circle.sc, again:

#- circle.sc
#- Copyright (c) 2010, HerongYang.com, All Rights Reserved.
#
.flash bbox=150x150 background=gray
.circle myCircle r=50 line=5 color=black fill=green
.put myCircle x=25 y=25
.end

Compile it into circle.swf using SWFC script compiler from SWFTools:

C:\herong>\local\SWFTools\swfc.exe circle.sc -o circle.swf

First dump it with the SWFTools SWF dumper using "-D" option:

C:\herong>\local\swftools\swfdump -D circle.swf

[HEADER]    File version: 6
[HEADER]    File is zlib compressed. Ratio: 94%
[HEADER]    File size: 159
[HEADER]    Frame rate: 50.000000
[HEADER]    Frame count: 1
[HEADER]    Movie width: 150.00
[HEADER]    Movie height: 150.00
[009]     3 SETBACKGROUNDCOLOR (be/be/be)
[020]    76 DEFINESHAPE3 defines id 0001
           | fillstyles(01)        linestyles(01)
           | 1 ) SOLID 00ff00ff    1 ) 4.00 000000ff
           |
           | fill: 01/00 line:01 - moveTo 0.00 0.00
           | fill: 01/00 line:01 - moveTo 85.30 85.30
           | fill: 01/00 line:01 - splineTo (70.70 99.90) 50.05 99.90
           | fill: 01/00 line:01 - splineTo (29.40 99.90) 14.80 85.30
           | fill: 01/00 line:01 - splineTo (0.20 70.70) 0.20 50.05
           | fill: 01/00 line:01 - splineTo (0.20 29.40) 14.80 14.80
           | fill: 01/00 line:01 - splineTo (29.40 0.20) 50.05 0.20
           | fill: 01/00 line:01 - splineTo (70.70 0.20) 85.30 14.80
           | fill: 01/00 line:01 - splineTo (99.90 29.40) 99.90 50.05
           | fill: 01/00 line:01 - splineTo (99.90 70.70) 85.30 85.30
           |
[028]    11 NAMECHARACTER adds information to id 0001 "myCircle"
[038]    13 EXPORTASSETS
            exports 0001 as "myCircle"
[01a]    18 PLACEOBJECT2 places id 0001 at depth 0001 name "myCircle"
           | Matrix             
           | 1.000 0.000  25.00 
           | 0.000 1.000  25.00 
[001]     0 SHOWFRAME 1 (00:00:00,000)
[000]     0 END

Then disassemble it with the Flex SWF disassembler:

C:\herong>\local\flex\bin\swfdump circle.swf

<!-- Parsing swf file:/C:/herong/circle.swf -->
<!-- ?xml version="1.0" encoding="UTF-8"? -->
<swf xmlns='http://macromedia/2003/swfx' version='6' framerate='50'
  size='3000x3000' compressed='true' >
  <!-- framecount=1 length=159 -->
  <SetBackgroundColor color='#BEBEBE'/>
  <DefineShape3 id='1' bounds='(-40,-40),(2040,2040)'>
    <fillstyle type='0' color='#00FF00FF' />
    <linestyle color='#000000FF' width='80' />
    <styleChange dx='0' dy='0' fillStyle0='1' lineStyle='1' />
    <styleChange dx='1706' dy='1706' />
    <curve cdx='-292' cdy='292' dx='-413' dy='0' />
    <curve cdx='-413' cdy='0' dx='-292' dy='-292' />
    <curve cdx='-292' cdy='-292' dx='0' dy='-413' />
    <curve cdx='0' cdy='-413' dx='292' dy='-292' />
    <curve cdx='292' cdy='-292' dx='413' dy='0' />
    <curve cdx='413' cdy='0' dx='292' dy='292' />
    <curve cdx='292' cdy='292' dx='0' dy='413' />
    <curve cdx='0' cdy='413' dx='-292' dy='292' />
  </DefineShape3>
  <!-- unknown tag=40 length=11 -->
  <ExportAssets>
    <Export idref='1' name='myCircle' />
  </ExportAssets>
  <!-- instance of myCircle -->
  <PlaceObject2 idref='myCircle' name='myCircle' depth='1'
    matrix='t500,500'/>
  <ShowFrame/>
</swf>

Conclusion:

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

 Downloading and Installing Flex SDK 4.1

 "mxmlc" - Adobe Flex Compiler

 Spark Component Architecture

 MXML Example Using Spark Components

 Compiling ActionScript 3 Scripts with 'mxmlc'

 SWF Disassembler in Flex SDK

Dumping Simple SWF Files

 Dumping SWF Files Containing ActionScript 3 Statements

 Dumping SWF Files Generated from ActionScript 3 Classes

 Dumping SWF Files Generated from MXML Applications

 SWF File Structure and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials

 References

 Full Version in PDF/EPUB