#969 how to decompile and recompile?
I am trying to decompile a SWF, change something and recompile the result with MXML to get (almost) the same SWF. How does that work? I figured out the ActionScript part (with export all parts), but running the SWF only shows an empty white window, because it has removed all the connections between sprites and classes. Does it need an XML or something? MXML could not compile the SWF XML export.
I think it is nearly impossible what you want to do. You won't be able to export your original swf file perfectly. (What you can recompile again, and everything will be the same) You should try to edit your swf file in FFDec.. maybe with directly editing the AS code (experimental feature), or if it is not working, then edit the pcode.
I do not need it to be perfectly, just "almost the same". Especially the sprites are irrelevant. As long as I can recognize anything, and do not just get an empty window. Only the data it sends to the server has to be identical. I want to change too much to do it directly in the old SWF.
In this case the only thing you can do is that you fix all the problems in the exported scripts, then you can recompile it. But if you can recompile it, it doesn't means that it will be exactly the same, because when there is any problem in the decompilation which is not a syntax error the result can be different...
We do not advertise our decompiler to produce compilable scripts or FLA. We just try to make some result which is similar to original scripts. We cannot guarantee compilability. That's why we have ActionScript editor and especially P-code editor, which to some point we can make relatively reliable. If you send us example of "how it is decompiled" and "how it should be decompiled" we can make some fixes/adjustments and try to improve the decompiler.
But after fixing the syntax errors all the ActionScripts seem to do exactly what they are supposed to do. Just the sprite connections seem to be missing. And all metadata tags. But I have no idea what to do with the sprites. (I have never used MXML before)
Current version of of our decompiler does not decompile Flex metadata tags or other Flex specific code. Only classic AS3 code is decompiled. There already exist some issues in our tracker about Flex, its components, etc. We might add the support in the future, I can't tell you when... So this issue is more like feature request to support Flex code, okay?
>So this issue is more like feature request to support Flex code, okay? Probably Or a question, what is the difference between Flash and Flex? I have no clue. And where do you can find Flex stuff in the SWF? Even if it is not decompiled, is it at least disassembled/dumped?
So the solution was to put [Embed(source="../sprites/DefineSprite_123_ClassName_ClassName/1.png")] for the relevant class ClassName. Although that breaks the compilation, because the class was a MovieClip which does not accept pngs. So it would be better if animated sprites were exported as SWFs. Anyways, now I have checked all 115k LOC and the compiled output seems to work fine.