How to extract Flex 1.5 MXML controls ActionScript source code

Sometime is very useful to have control implementation source code at hand. This article describe how to retrieve it. One of possible solutions is to see the source code under Flex Builder debugger.

Let's look at mx_debug.swc file (in my case the path is "C:\Program Files\Macromedia\Flex\lib\frameworks_debug\mx_debug.swc"). SWC is Flash component file, seems like internally it is plain ZIP archive (starts with magic PK and understandable by ZIP extractors). After unzipping mx_debug.swc content we will find "Library.swd" file inside. SWD files are debugging files containing necessary code information. Probably (?) Flex Builder debugger uses this information to provide control source code during debugging process.

Open "Library.swd" file content in plain text or binary editor, e.g. in Notepad, you'll see our controls source code inside. Unfortunately I didn't find SWD files extractor, so created simple one ( It's chunky but works fine at least with "Library.swd".

Other interesting places to see source code
Debugger friends
Related products
Flex 2 source code

How to extract Flex 2 source code? Now only Flex 2 Beta 2 released. There is rumor that with final Flex 2 release Adobe will publish source code for some MXML components, probably it will be around framework.swc, and possible chart.swc libraries, but I don't know, it's just my assumption.

There are also amusing packages like "playerglobal.swc" (player runtime), "enterprise.swc" (FES -* packages), "rpc.swc" (remoting stuff, mx.messaging.*, mx.rpc.*), "automation.swc" etc. Probably "playerglobal", "enterprise" or "rpc" packages source code will not be published at all for security, money or other reasons.

Good news is that it's possible (after some spelunking with Flex Builder binaries) extract ABC (ActionScript byte code???) code for all components described in these libraries and then extract disassembled IL code. Not all classes are disassembled at this moment on my side. Also there is no AS3 decompiler (to create pure AS code). Nevertheless disassembled information is very useful and helps me to understand Flex 2 platform. Also I am not going to publish this tools and techniques at all. Probably it's question of time and someone else will create SWF decompiler tool for new Flash platform. Thanks. Vadim.

Revision:7, Last Modified: 03/25/06 01:19, by Vadim Melnik. Visit my Homepage.