flasm man page

flasm — A swf bytecode assembler/disassembler


flasm [-daubzx] filename


Disassemble the given SWF file to the console
Assemble the given flasm project
Update SWF, replace flasm macros
generate __bytecode__ instruction or byte sequence
ompress SWF with Zlib
Decompress SWF


flasm -d foo.swf

Disassemble foo.swf to the console. To see action offsets in disassembly set showoffset and hexoffset options in flasm.ini.

flasm -d foo.swf > foo.flm

Disassemble foo.swf, redirect the output to foo.flm. Alternatively you can simply call flasm without command: flasm foo.swf creates foo.flm in the same directory.

flasm -a foo.flm

Assemble foo.flm and update the SWF defined inside. The backup of original SWF is created with .$wf extension.

flasm -u foo.swf

Disassemble foo.swf to the temporary file. Execute flasm macros embedded in SWF. Make trivial optimizations automatically: remove double nots, replace 0.0 with 0, rebuild constant pools, clear register arguments. Create .$wf backup, update the original SWF.

It's a good idea to update the final version of SWF with flasm -u. Don't expect the SWF to be noticeably faster, it will just make it a bit smaller.

flasm -b foo.txt

produce __bytecode__ instruction or byte sequence, depending on boutput setting in flasm.ini. Takes as input a simple action list without any movie or frame declarations. Output is sent to console. Redirect it to file if you wish: flasm -b foo.txt > foo.as When boutput is set to 1, Flasm produces binary output

flasm -x foo.swf

Decompress foo.swf, create .$wf backup.

flasm -z foo.swf

Compress foo.swf, create .$wf backup. Source SWF doesn't have to be Flash MX/MX 2004 file. However, only Flash MX/MX 2004 player will be able to play the resulting compressed file.

flasm settings are read from flasm.ini. There aren't many of them, and they are commented. You may, for example, switch bytecode offsets on and off there.


flasm disassembles your entire SWF including all the timelines and events. Looking at disassembly, you learn how the Flash compiler works, which improves your ActionScript skills. You can also do some optimizations on the disassembled code by hand or adjust the code as you wish. flasm then applies your changes to the original SWF, replacing original actions.

It's also possible to embed flasm actions in your ActionScript, making optimizing of large projects more comfortable. flasm is not a decompiler. What you get is the human readable representation of SWF bytecodes, not ActionScript source. If you're looking for a decompiler, Flare may suit your needs. However, Flare can't alter the SWF.




Copyright (c) 2001 Opaque Industries
(c) 2002-2004 Igor Kogan

All rights reserved. See LICENSE.TXT for terms of use.