Dumping SWF Files Generated from ActionScript 3 Classes

This section provides a tutorial example on how to dump and disassemble SWF files generated from ActionScript 3 classes. '-D' and '-asm' options should be used.

In this example, let's dump and disassemble a SWF file generated from a Flash application written as an ActionScript 3 class, MyMovieClip.swf. See previous chapter on how MyMovieClip.swf was created.

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

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

[HEADER]        File version: 9
[HEADER]        File is zlib compressed. Ratio: 71%
[HEADER]        File size: 683
[HEADER]        Frame rate: 25.000000
[HEADER]        Frame count: 1
[HEADER]        Movie width: 150.00
[HEADER]        Movie height: 150.00
[045]         4 FILEATTRIBUTES as3
[052]       614 DOABC
sealed class <q>[public]com.herongyang::MyMovieClip 
     extends <q>[public]flash.display::MovieClip{
     staticconstructor * =()(0 params, 0 optional)
    [stack:0 locals:1 scope:8-8 flags:]
    {
        00000) + 0:0 returnvoid 
    }

     constructor * <q>[public]com.herongyang::MyMovieClip=()
     (0 params, 0 optional)
    [stack:1 locals:1 scope:8-8 flags:]
    {
        00000) + 0:0 getlocal_0 
        00001) + 1:0 constructsuper 0 params
        00002) + 0:0 getlocal_0 
        00003) + 1:0 callpropvoid <q>[private]::addCircle, 0 params
        00004) + 0:0 getlocal_0 
        00005) + 1:0 callpropvoid <q>[private]::addText, 0 params
        00006) + 0:0 returnvoid 
    }

    slot 0: var <q>[private]::green:<q>[public]::uint = 65280
    slot 0: var <q>[private]::black:<q>[public]::uint = 0
     method <q>[public]::void <q>[private]::addCircle=()
     (0 params, 0 optional)
    [stack:4 locals:1 scope:8-8 flags:] slot:3
    {
        00000) + 0:0 getlocal_0 
        00001) + 1:0 getproperty <q>[public]::graphics
        00002) + 1:0 getlocal_0 
        00003) + 2:0 getproperty <q>[private]::green
        ...
        00020) + 0:0 returnvoid 
    }
    ...
}

 initmethod * init=()(0 params, 0 optional)
[stack:3 locals:1 scope:0-8 flags:]
{
    00000) + 0:0 getlocal_0 
    00001) + 1:0 pushscope 
    00002) + 0:1 getglobalscope 
    00003) + 1:1 getlex <q>[public]::Object
    00004) + 2:1 pushscope 
    00005) + 1:2 getlex <q>[public]flash.events::EventDispatcher
    00006) + 2:2 pushscope 
    00007) + 1:3 getlex <q>[public]flash.display::DisplayObject
    00008) + 2:3 pushscope 
    00009) + 1:4 getlex <q>[public]flash.display::InteractiveObject
    ...
    00027) + 0:1 returnvoid 
}

slot 1: class <q>[public]com.herongyang::MyMovieClip=MyMovieClip
[04c]        31 SYMBOLCLASS
                exports 0000 as "com.herongyang.MyMovieClip"
[001]         0 SHOWFRAME 1 (00:00:00,000)
[000]         0 END

Then disassemble it with the Flex SWF disassembler using "-asm" option:

C:\herong>\local\flex\bin\swfdump -asm MyMovieClip.swf

<!-- Parsing swf file:/C:/herong/MyMovieClip.swf -->
<!-- ?xml version="1.0" encoding="UTF-8"? -->
<swf xmlns='http://macromedia/2003/swfx' version='9' framerate='25' 
  size='3000x3000' compressed='true' >
  <!-- framecount=1 length=683 -->
  <FileAttributes hasMetadata='false' actionScript3='true' 
  suppressCrossDomainCaching='false' swfRelativeUrls='false' 
  useNetwork='false'/>
  <DoABC2 name=''>
    <ProgramNode>
      <pkgdefs>
      </pkgdefs>
      <statements>
        <StatementListNode>
          <items>
            <BinaryProgramNode>
              <StatementListNode>
                <items>
                </items>
              </StatementListNode>
              <BinaryClassDefNode name="MyMovieClip">
                <attrs>
                  <AttributeListNode public='true'>
                  </AttributeListNode>
                </attrs>
                <name>
                  <QualifiedIdentifierNode name="MyMovieClip">
                    <AttributeListNode public='true'>
                    </AttributeListNode>
                  </QualifiedIdentifierNode>
                </name>
                <baseclass>
                  <LiteralStringNode value="flash.display:MovieClip"/>
                </baseclass>
                <instanceinits>
                  <VariableDefinitionNode>
                    <attrs>
                      <AttributeListNode private='true'>
                      </AttributeListNode>
                    </attrs>
                    <list>
                      ...
                    </list>
                  </VariableDefinitionNode>
                  ...
                  <BinaryFunctionDefinitionNode>
                    <name>
                      <FunctionNameNode kind="-133">
                        <QualifiedIdentifierNode name="addCircle">
                          <AttributeListNode private='true'>
                          </AttributeListNode>
                        </QualifiedIdentifierNode>
                      </FunctionNameNode>
                    </name>
                    <attrs>
                      <AttributeListNode private='true'>
                      </AttributeListNode>
                    </attrs>
                    <fexpr>
                      <FunctionCommonNode>
                        ...
                      </FunctionCommonNode>
                    </fexpr>
                  </BinaryFunctionDefinitionNode>
                  ...
                </instanceinits>
                <statements>
                  <StatementListNode>
                    <items>
                    </items>
                  </StatementListNode>
                </statements>
              </BinaryClassDefNode>
            </BinaryProgramNode>
          </items>
        </StatementListNode>
      </statements>
    </ProgramNode>
  </DoABC2>
  <SymbolClass>
    <Symbol idref='0' className='com.herongyang.MyMovieClip' />
  </SymbolClass>
  <ShowFrame/>
</swf>

Conclusion:

Last update: 2010.

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

 PDF Printing Version