Question

Been looking for this for some time now. Just wanted to know if there is anything out there that can do this automatically.

Basically actionscript and javascript are very similar, changing a few actionscript variables to a format javascript can understand will lead allow it to work in a browser environment. The problem is that with a lot of actionscript, manual editing can get long and error prone.

So what I am looking for is a tool that might automate this, if there is one anyway. I realize that JavaScript uses the DOM and actionscript does not, so the flash functions are of course not available in JavaScript. However in a well structured flash app the functions to communicate with the flash objects would be separated, meaning rewriting those functions will be all you need to do to make it work fully in JavaScript.

The flash game I am editing is around 1mb, of almost pure AS3 that is why I would like to auto translate it rather then manually.

Just to make sure the reason I say it is easy is there is a few points of difference between the 2 languages.

  1. JavaScript figures out the variable type automatically, so :Boolean and :Number ans such is not needed.
  2. JavaScript does not have an automatic "this if undefined" parameter in functions (function(var = true). So you need to make sure to adapt that in the first line inside the AS function when converting.

That's basically it for what I have seen needs to be converted in the app I am working with. The code is simple, just extremely large. I have tried to "publish" it into html5, however that does not work.

This video shows the process: http://gotoandlearn.com/play.php?id=172

Was it helpful?

Solution

After searching to no avail I don't think this is impossible just even if similar there is really no reason to actually make an automated script to convert.

The time it would take to automate it would be around the same as rebuilding when you already have the as3 code as an example. A plain conversion would lead to many more issues then it would solve. But when rebuilding it would be built to compensate for those issues.

So my recommendation for anyone attempting this is to just rebuild it, flash and javascript run in 2 different environments so its a lot less pain in the long run to just do a rebuild.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top