`
seya
  • 浏览: 356869 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

How to extract Flex 1.5 MXML controls ActionScript source code

阅读更多

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 (swd.zip). It's chunky but works fine at least with "Library.swd".

  • Copy "swd.js" file to certain directory on your PC, (e.g. C:\Temp).
  • Copy "Library.swd" file to the same folder.
  • Open command-line prompt and set appropriate current directory, (in our case it's C:\Temp).
  • Execute the following command-line

     C:\Temp>cscript swd.js Libary.swd

  • Wait for few minutes (of course C++/C# or Java implementation will make this in seconds, but perfomance is not the key in this case). As result it will create 452 files under C:\Temp folder.  


Other interesting places to see source code
  • "C:\Documents and Settings\<User>\Application Data\Macromedia\Flex Builder 1.5\Configuration\Objects\MXML\WEB-INF\flex\"
  • "C:\Documents and Settings\<User>\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Classes\"
  • "C:\Program Files\Macromedia\Flash MX 2004\en\First Run\Classes\"
  • "C:\Program Files\Macromedia\Flex\lib\system_classes\"
  • "C:\Program Files\Macromedia\Flex\lib\frameworks\mx.swc"
  • "C:\Program Files\Macromedia\Flex\lib\frameworks_debug\mx_debug.swc"
  • "C:\Program Files\Macromedia\Flex\resources\flexforflash\FlexforFlash.zip"
  • "C:\Program Files\Macromedia\Flex Builder 1.5\Configuration\Objects\MXML\WEB-INF\flex\system_classes\"
Debugger friends
Related products
  • Macromedia Flex 1.5
  • Macromedia Flex Builder 1.5
  • Macromedia Flash MX Professional 2004
Downloads
  • SWD source code extractor - swd.zip (1,2 KB)
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 - mx.data.* 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.

 

转自:http://blog.csai.cn/user1/265/archives/2007/14491.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics