Is there a "big-dummy's guide" to converting an SWF to OpenFL

Okay, so here’s the deal. I’ve got years(!) of programming experience, not much of it using Flash, and I don’t have (and don’t intend to buy) a copy of Flash. I do have an open-source SWF decompiler by which I can extract the source. I’m using a Mac, so I don’t have use of FlashDevelop. (I have used Haxe, and to a lesser extent OpenFL, substantially, in the past.)

All that being said … I’ve got an SWF-file containing a Flash game that I didn’t write, and what I’d like to do now is to use OpenFL to, say, make that into an app for the iOS and Android environments. In short, as a hands-on self-learning exercise for using OpenFL to do this. (“Take a sip from the firehose,” etc.) The app has several animations, speech, non-trivial logic. A good test-bed, I think, for my purposes.

Anyhow: is there a “big dummy’s guide” out there for doing this? Where someone walked step-by-step through the process of converting “an SWF” into “an app” for different targets. Something, also, that discusses the alternatives between “referencing the SWF as a resource” versus “extracting resources from it into other forms.” Basically, the more thorough the treatment of the overall subject, the better. “Show me what the general process is, what the steps might be, where the rocks are.” To make my immersive self-teaching exercise more productive.

Suggestions?

Converting as3 code into haxe is simple, though it can be time consuming but there’s a tool to accelerate the conversion. https://github.com/HaxeFoundation/as3hx

Using a swf in openfl isn’t too hard either https://github.com/openfl/swf/
and if you are using it for layout there’s a specialized lib for that https://github.com/openfl/layout

To get animation from a swf to something usable on other target there’s http://threerings.github.io/flump/

Though I never encountered any documentation on how to decompile/extract a swf, simply because people have their flash project and/or as3 source code.

1 Like

I do have source-code within the (AS3 …) SWF and can, indeed, extract it. (There’s a very good Java-based program on GitHub…) I know who the author is and got it from him with his blessing.

I’ve stumbled-upon the tools that you refer to, and tried some. I don’t have Flash itself. And, basically, I’m looking for “that 10,000-foot overview” where someone walked through the process, showed how and when to use these tools, and so on. “Bringing it all together,” so to speak. I learn fast. :slight_smile: Looking for stuff to help me learn faster, and more efficiently.

(In time, I’ll “give back” by writing a blog post of my own somewhere.)

You’ve forgotten a step. The first thing to do is get the AS3 project working again.

All the AS3 code should be organized into classes (no timeline code!), and the assets should be bundled into their own swf/swc, or into sprite sheets. You should be able to hit “compile” in FlashDevelop and get a working SWF out of it.

Why don’t you just ask for the source files? That would make this easier.

This is an exercise. Again, no FlashDevelop.

The things that you describe doing, player_03, are exactly the sort of things I am aware that I need to do. What I’d like to find on the Internet right now is a concise description of how to do it – and, indeed, why to do it.

For instance … “organize into classes, no timeline.” “Bundle assets.” Etc. All very-correct steps to be done and I’m sure that I could “stumble through” how to do every one of those things. I’m very good at figuring things out when I have to. But I’ve really learned not to stumble. Avoid hitting your own head by learning from others, who did. ; And who subsequently wrote about it.

FlashDevelop is a free AS3 and Haxe code editor. If you can take a Flash project and built it with FlashDevelop (which calls the Adobe compiler), a natural first-step in porting is to use FlashDevelop, but with Haxe instead of ActionScript, to still target Flash Player. This means that everything is the same, except you’ve gone from ActionScript to Haxe. Once this is working, then transitioning from Flash Player to other OpenFL targets would be simpler in theory :smile:

Yes, I would recommend no timeline code, only classes, and assets is something that can be decided, OpenFL supports standard JPG, PNG assets, or you can pull from a SWF instead. The former is more straightforward, but if you have Flash Professional (the one that costs money) SWF layouts can be nice for having a good 2D layout workflow. If you have the raw assets, though, it is probably simpler to work with them directly

… for Windows. There’s where it stops. I’m not using Windows.

And, I’m not using Flash.

Those are the terms of my exercise. :slight_smile:

People are saying that IntelliJ is really good, but you don’t really have to use an IDE,

What @singmajesty really meant is to have the source code out of the swf and working with haxe, which can compile to flash without the flash software (the editor not the player obviously), or openfl which allow you to use the flash api (in haxe ofc) for html5/native/mobile…

So into something that look like this https://github.com/openfl/openfl-samples/tree/master/PiratePig

FYI, I have extracted the AS3 source-code from the SWF.

When I say, “big dummy’s guide,” I really mean: comprehensive overview. Something that will help to reduce the uncertainty and indecision as to exactly how to proceed with the conversion, and what issues might ordinarily come-up when doing so. All collected into one place or book.

Happy to answer questions as they come, I apologize that there’s no single convenient guide at the moment :slight_smile: