Copy code between JavaScript and ActionScript library without bridging

I am contributing to the writing of the Flex / ActionScript library, and in the future I will be contributing to writing the same library in JavaScript. Instead of writing a library in each language and maintaining them separately, I was wondering if it was possible:

1) Write the code in one language and pass the code to another for example. Write code in JavaScript and use the same .js files in ActionScript

or

2) Write the code in one language and convert to another

I know it is possible to communicate between Flash / ActionScript and JavaScript, but I would like to avoid the overhead of using a technology bridge, so this is not an option.

How do other people go about writing and maintaining libraries that do the same thing, but in different languages? Specifically, how do people do it between JavaScript and ActionScript?

+2


source to share


2 answers


How about haXe .

You write code in one language and can compile it into a variety of forms, including JavaScript files and compiled flash memory (versions 6-10). They even recently started supporting C ++ compilation.



This will allow you to have the same source code (pre-compilation) for your JS and AS3 projects.

(Note when FlashDevelop started supporting it)

+1


source


PureMVC does this pretty well. The reference implementation is written in AS3, and ports (including the JS version) are supported based on this implementation. It would be non-trivial to write a converter, and it would probably be easier to maintain separate versions.



0


source







All Articles