by: malczak, tech: as3, status: betaswfutils - tools for reading SWF files with ActionScript3

swfutils is a collection of ActionScript 3 classes for reading SWF files. With swfutils you can parse swf files, and read all its tags. Dump actions for AVM1 (ActionAcript1/2) and AVM (ActionAcript3 ABC code). DoABC parsing module is based on code from Tamarin project (utils/abcdump.as).

swfutils works with Flash CS3 / Flex / AIR. It uses ByteArray for reading swf files. In AIR (Desktop), to decrease memory usage, you can work with FileStream classes instead.

swfutils library has beed recently heavily tested, thanks to this many errors has been detected and fixed. Library was rebuilded using Flash Player 10 objects and with performence improvements. It is now being used in komixo maker, and is still under developement.

Features

  • read compressed and uncompressed swf files
  • read swf file basic informations (eq. framerate, document dimensions etc.)
  • read all tags defining swf movie (you get an array of al tags so you can read any information you are intrested in)
  • read all exported classes (this can be later used in applicationDomain.getDefinition('...'), so you can create instances of exported classes without knowing what is exported
  • get any information about classes present in file (inheritance, implemented interfaces, methods, properies)
  • extract information from DoABC blocks (compiled as3 code) - this provides detailed information about exported classes
  • decompile ActionScript 1/2 action based code
  • decompile DoABC (ActionScript 3) code

Moved to branches

  • export shapes (vector content) from swf files (under developement)
  • decompile (so-called) encrypted swf files - creating micoro-vm for as2 code and porting c++ code from swfdb decrypter to AS3 (under developement)

SVN

Current library version in 0.3 and it is available via svn repository:
http://svn.segfaultlabs.com/swfutils/

Package contains library source code, compiled library, documentation and working example (AbcFlex.mxml).

Documentation

Docs are included in svn repository.

Online version is also available at http://segfaultlabs.com/docs/swfutils

Example

This is example of using swfutils to get information about swf file content. If loaded SWF file contains as3 code You can dump abc data.
Online flex example is available here. Right click to see source code for this example.
Dumping ABC code can cause script running long, and Your browser can die!

Recommended literature

  • SWF and FLV File Format Specification - Version 9
  • ActionScript Virtual Machine 2 (AVM2) Overview
  • Tamarin project source code
Website content premeditately commited by segfaultlabs (malczak & sobstel).
Layout by mlando. Icons by DryIcons.com. All rights reserved, of course.