AS3Watson - Flash Introspection Tool

What is AS3Watson?

AS3Watson helps you examine and modify properties at run-time in Flash applications programmed in Adobe's latest scripting language - ActionScript 3.0.

Variables (public, as well as private) in Flash applications are exposed to you for editing and modification as the loaded SWF executes.

Certain areas of Flash development - especially in physics simulations - deal with large amounts of configuration variables, such as those for weight and gravity. In order to tweak and refine these applications, the traditional workflow has been to make incremental changes, publish, and re-publish to see the new changes in effect. From personal experience, I have spent hundreds of times waiting for an application to recompile after changing values by miniscule amounts (all in the name of perfection, heh heh). With AS3Watson, you are able to modify and fine-tune these values in realtime as your application is running, and see your changes take effect immediately.

FAQs:

What makes AS3Watson different from other Flash-based solutions, like MonsterDebugger?

Although many don't make this limitation clear, existing solutions only allow you to examine public variables. In code you intend to release, it is often cumbersome and even impractical for you to refactor to ensure that properties you want exposed to the debugger are public. AS3Watson is useful for times that you don't want to (or cannot) specifically include and activate these debugger packages.

How does this work?

The enumeration of public variables in an AS3 SWF is fairly simple. There is only one built-in facility in the ActionScript 3.0 language to perform language reflection - runtime introspection of the structure and behavior of AS3 objects, and that is flash.utils.describeType(). To obtain private variables the app performs bytecode weaving to transform parts of the bytecode as it is loaded. This is done with the excellent libraries as3swf by Claus Wahlers and as3commons-bytecode that I have modified and tweaked to work expressly for this purpose. If the SWF load fails, go ahead and enable the Safe Mode option in the File menu - this will skip the weaving process, and will also mean that you will only be able to examine public variables and functions. Bytecode weaving might fail with very large or very complex files. This is generally more my fault than a fault in the theory. In theory and under ideal conditions we could rewrite code and perfectly intercept any API call flawlessly, but in practice this takes much time to... put into practice, so to speak. While the goal is to support every single case, there are many, many pitfalls.

Download

AS3Watson is free software.
1.0.1: http://www.mediafire.com/?3jcypa56m4fsicj

Version History

1.0.1:
Fixed error with SWF accessing stage in constructor
Bytecode weaver is now less aggressive - improved compatibility for more SWFs.

1.0:
General public release

Screenshots

Future Plans

The eventual goal for AS3Watson is to turn into a more general-purpose AVM2 workbench for static bytecode analysis and modification, to fill the void that the excellent Yogda application left behind. Of course, AS3Watson will continue to emphasize dynamic application analysis.

Last updated: 27 Jan 2013