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.
- JavaScript figures out the variable type automatically, so
:Boolean
and:Number
ans such is not needed. - 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