Step by Step procedure to convert a flash game to html5

Hi,

I’ve been trying to convert a (compiled) .swf file to AS/haxe/JS/html5. The swf consists of a bunch of frames through which you navigate by pressing buttons (no physics or complex moving stuff). I don’t have the source code. I used JPEXS to decompile it, and exported all the assets and AS snippets. This results in a folder with hundreds of separate, small AS code files of the kind:

on(release){
   gotoAndPlay(18);
}

When I run as3hx (latest version of haxelib and as3hx) on the folder with the AS snippets however, I get a bunch of errors like this (but way more):

In /scripts/DefineButton2_2476/on(release).as(1) : Unexpected on
In /scripts/DefineSprite_2412/frame_50/DoAction.as(1) : Unexpected stop
In /scripts/DefineSprite_2412/frame_15/DoAction.as(1) : Unexpected _root
In /scripts/DefineSprite_188/frame_10728/DoAction.as(1) : Unexpected gotoAndPlay

The ./out folder ends up empty. If I run as3hx on one of the .as samples in the openfl-as samples it does work correctly and I do end up with the expected .hx files. Maybe JPEXS outputs a different version of AS?
@sibli_busro did you manage to do the conversion? How exactly did you extract the ActionScript from the .swf file with JPEXS? And then how did you use as3hx on the output?

Then I saw the announcement that openFL with npm now also supports AS source code. This would be interesting, since I (presumably) have all the AS code and the assets. So basically this could work straight on the decompiled .swf? But I don’t really see how all the tiny .as snippets coming out of JPEXS would fit together in an openFL app like the samples? It seems like the glue tying together all the assets and tiny logic fragments is missing. Was JPEXS just not able to decompile the entire .swf? Or am I missing something?

Any help is much appreciated :slight_smile: . Thanks in advance!

PS: when I run the openFL (npm) samples, everything works as expected, both with the ES6 and the AS3 samples.