1 Reply Latest reply on Jun 5, 2012 6:35 AM by sinious

    AS3 to JS conversion: future and preparation


      Hey guys!!


      So, new job here and big responsabilities. I have a HUGE project in my hands and my mission is to implement it with Flash and AS3 but later on I'll need to migrate ALL OF IT to HTML5 + JS. Well, I know there are things like the EasyJS and stuff but that's not quite what I'm looking for. I need to know for sure if in the near future we'll be able to convert  entire flash projects to JS. Is Adobe working on it but just didn't have the time? Should I do it myself somehow? How should I prepare my code so it's close to ready when this conversion is made possible?


      My first thought was to program for AS3 pretending I'm doing it in JS...I'd create in AS3 classes with the same name and signatures of EaseJS ones so I can use the about same code in Flash and in JS. Do you guys think this is a good idea? Coding this way would make the flash project terribly ugly =|


      I really need help here, I hope someone from Adobe can give me some piece of advice and answer this questions about the future.





        • 1. Re: AS3 to JS conversion: future and preparation
          sinious Most Valuable Participant

          Adobe cross compiles AS3 to ARM, I think they can handle AS3 (ECMAScript compliant) scripting to JS. The problem is probably coming from the fact that JS is still prototype and converting OOP oriented code to prototype isn't easy or even sometimes possible. It literally almost NEEDS to be hand redone. But that's actually the easier part of the "hard part".


          The difficult thing is there are tons of times when certain things will need to be done on Canvas and others simply using built in HTML rendering. Combining the two sometimes may not be possible. You may have an animation with text behind it. They'd choose to cross compile the animation into blitting it into the canvas but always choose using regular text anywhere you use regular text. Now the text is on top of canvas instead of appearing behind your animation unless they knew to zindex it. Or, they'd need to know the text is behind and blit the text into the canvas. Etc etc.. The situations you'd get into and the efficient, device-friendly way you'd convert from one project to another is astoundingly varied and pretty near impossible.


          Even if they do a pretty good half implementation of some small parts of AS->JS, I would never expect there to be a perfect "Export to HTML5" option that will do 100% of your work. They don't offer 100% of any conversions targets capabilities currently either. AIR for iOS does not even almost support everything obj-c/cocoa can do. AIR for Android does not even almost do everything Java+SDK can do. They just converted "enough" to make it a usable product. Even their native extensions have serious limits.


          At this point in time I would expect no magic bullets. Possibly some help, nothing automatic.


          At best, if this really is a complex project, I'd start to write both at the same time. You may find something you're trying to do in one is impossible in the other. It makes choices for you.