Monday, August 18, 2008

SoThink SWF Decompiler (Thoughts, Bugs, Suggestions)

I recently had to use a SWF Decompiler to recover a lost FLA and code library. This is my first experience with a decompiler so I am not sure how SoThink compares to other companies. I chose SoThink because they seemed to have a solid reputation and active forum.

I was a little scared at first when I had trouble getting my registration key and noticed there were many similar posts in the forum, but their support reacted within the first 24hours as promised and I was good to go.

I was able to grab my FLA and then separate my code library without trouble. But when I went to try to compile I found out I was in for a ride... Compared to redoing the entire project, every issue I list below is minor and petty. However, it would be nice to have everything working right out of the box.

Issues with the FLA:
All of the MovieClips, Layers, etc were renamed to things like "Layer 2" or "Sprite 255". I realize most of this is unavoidable since the Flash IDE ditches any unnecessary info when it compiles. However, instead of naming it Sprite 255, it would be nice if it named it to the Class Name. If it was based off of "some.package.DropDownMenu" I don't think it would be hard to call it "DropDownMenu 1". Better yet, why not make a folder structure in the library mimicking the package? Create a folder called "some", another called "package", and then place the DropDownMenu movieclip there. I think its pretty standard for most developers to follow a similar file structure, and if not, it would at least be easier to understand than looking through a few hundred sprites. Just a thought... or wish for next version.

Another issue regarding the FLA is that the library assumes everything is based off of MovieClip and is exported on Frame 1. Its easy enough to write a jsfl script to change the export frame, but having to go through and reconfigure base classes was a pain in the ass. Not sure if the compiler ditched them or if SoThink just assumed they would be movieclips.

Issues with the Code:
The compiler keeps the name of any class variable (public, private, protected), but ditches all local variable names. So be prepared to see a bunch of code chalk full of "_loc_1" and "param1". It is annoying, but unavoidable due to the compiler. What is not unavoidable are the bugs created by SoThink's decompiler.

Original Code:
var margin:Number = 5;
this.leftMargin = this.rightMargin = margin;

Decompiled Code:
var _loc_1:Number;
this.leftMargin = 5;
this.rightMargin = _loc_1

Basically, instead of setting both Margins to 5, it sets the Left to 5 and the right to 0 since _loc_1 is never set. No compiler errors, just makes your project look like crap and can be fairly tough to uncover initially.

Another Example...

Original Code:
for(var i:int=0; i<; i++){
// Something

Decompiled Code:
var _loc_1:int = 0;
// Something

For some reason, when ever you try to change a variable by 1 in a conditional statement (if/while/for) it will change it to either -- or ++. This is not good since -- subtracts 1 from the total and then assigns it to the total. So each time this loop is called, is decreased. Therefore if you had a list of 5 items then you would only get through 3.

Granted, without this software I would be behind a couple months of work so I can't complain too much. However, it would be nice to have it not break the code and possibly clean up the FLA library so it is a bit more readable.


Anonymous said...

Regarding the difference of decompiled codes and original codes, the reason why they are different is because Flash optimize ActionScript codes when compiling them.

Ickydime said...

I realize Flash optimizes code and therefore changes it when it compiles, but these changes don't alter the code's meaning.

SoThink, on the other hand, has altered the meaning of the code when it decompiles. It is only occurring in a few cases, two of which I've shown above.

There was actually an instance where I was using a constant called "STATES" and it changed a slice of code from "if(a<STATES-1)" to "if(a<STATES--)" which threw an exception since you obviously can't alter the value of a constant. My point here is that change could not have been Flash optimizing the code, it had to of occurred during decompiling.

Unknown said...


I'm making a product demo and using a lot of screen captures published in swfs. The capture software I used did't publish the fla and I wanted to add some menu buttons to the swfs.

So I decided to use SoThink's SWF Decompiler. I was able to add the buttons but I discovered that the control bar that the capture software put had disappeared when I ctrl+Enter! It is shown as a sprite with all the buttons (pause/play, rewind, forward etc) in the decompiled fla but there are no actions attached to it nor to any buttons in it. I tried to look for the .as files in the Actions folder in Resources - but to no avail, sprite189 (for the control bar) doesn't exist in the Actions folder! Now I do not know how to make the menu without losing the control bar. I might have to add a control bar using the components I guess, but it's not fair to lose an existing one. ~ JP

Ickydime said...

Not sure I can help ya without seeing the files. But if you don't have any luck you could always try Trillix:

I have used it on a couple AS2 projects recently and haven't had much trouble getting them up and going. Haven't tried it on an AS3 project yet to compare.

Anonymous said...

ickydime, can i get your key for the decompiler?

ill give you a WinRAR key
and HyperCam2 key.

Ickydime said...

What do you think this is? A Warez site? No thanks.

Anonymous said...

Yeah, sorry about that, you can understand this part though, at 13. There is no way for me to get $80 easily. Or to get someone to use their credit card on a website for me. So you think maybe i could work it off or something, like I do alot of helpful stuff and you give me your key.
I make graphics.
I code batch.
I code vb (Visual Basic).
I can also do html, and javascript.
I'm very fluent in all of those.

You can have me do other things. You just have to name it.

Bl4ckScyth3 said...

Just got an account, i'm the anon who wants your key.
And you know something I noticed, they spelled software wrong on their splash screen. They spelled it "softwere" lmao.

sheela rajesh said...

I am very proud to read such an informative blog. i Will follow your updates in future so, please add more and more ideas.
Python Training in Chennai
Python Classes in Chennai
Big data training in chennai
JAVA Training in Chennai
Selenium Training in Chennai
Digital Marketing Course in Chennai
Python Training in Annanagar

yanmaneee said...

golden goose shoes
kyrie 6 shoes
kyrie irving shoes
nike shoes
air max 2019
nike kyrie 6
coach outlet online
yeezy boost

amit tavva said...

keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
digital marketing training in bangalore |

mtom said...

Thank you, I’ve just been searching for information about this topic for a while and yours is the greatest I’ve discovered till now. But, what in regards to the conclusion? Are you sure concerning the supply?

deiva said...

Good post. I learn something new and challenging on sites I stumbleupon on a daily basis. It's always interesting to read content from other writers and practice a little something from their web sites.
Digital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery

Unknown said...

Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing.

Big Data Hadoop Training In Chennai | Big Data Hadoop Training In anna nagar | Big Data Hadoop Training In omr | Big Data Hadoop Training In porur | Big Data Hadoop Training In tambaram | Big Data Hadoop Training In velachery

yanmaneee said...

supreme clothing
golden goose
supreme shirt
giannis shoes
kd 13
kevin durant shoes
golden goose outlet
supreme new york
stone island

thomas said...

Kardinal Stick Siam - relx a great promotion. Express delivery in 3 hours.

ufa football betting, casino, slots, lottery, direct website 1688, stable financial, 100% UFABET168.

Online Baccarat FOXZ24 Easy to apply, fast, บาคาร่า deposit-withdraw 10 seconds with the system.

Watch movies online, watch new movies, series Netflix HD 4K ดูหนังออนไลน์, watch free movies on your mobile phone, Tablet, watch movies on the web.

SEE4K Watch movies, watch movies, free series, load without interruption, sharp images in HD FullHD 4k, ดูหนังใหม่ all matters, all tastes, see anywhere, anytime, on mobile phones, tablets, computers.

GangManga read manga, read manga, read manga online for free, fast loading, clear images in HD quality, อ่านการ์ตูน all titles, anywhere, anytime, on mobile, tablet, computer.

Watch live football ผลบอลสด, watch football online, link to watch live football, watch football for free.

Mallela said...

Thanks for posting the best information and the blog is very marketing institute in hyderabad

Deekshitha said...

Informative blog
best digital marketing institute in hyderabad