<?php include("sample_utils.php"); // provides some utils and using mk $swfFN = "AztecDump.swf"; // swf to disassemble $flasm = new MKflasm($swfFN); // instantiate a disassembler $fStr = $flasm->disassemble(); // get in touch $str = trace_var("<pre>" .$fStr ."</pre>", "", true, true, true); ?>
this sample show how easy is to disassemble an swf with mk, the output is a syntax file flasm compliant. The other part: assembler is in progress it don't worth much words about it since there aren't enough testing cases, hope to release in near future.
You know bytecode is the final result of a "compiler" task. Surely it is not the best thing to deal directly with bytecode (e.g. writing your own flash app in that way), but it can offer a closer sight to evaluate if your code is efficent or secure (e.g. revealing URLs for malicious actions). On the other hand php is not adequate to implement a compiler, it misses a good parser/lexer generator for arbitrary syntax code. Anyway the disassembler gives many infos: header (width/height, frame rate, etc.), button, sprite (movieclip) instances and linkage symbols.
If you are looking for an alternative tool to compile your actionscript it is suggested to use mtasc, a great and open source actionscript 2 compiler (it is much faster than flash compiler itself), another interesting project is haxe from the same author of mtasc.
![]()