Convert Actionscript to Javascript

13,823

Solution 1

Javascript and ActionScript (especially AS3) are syntactically similar languages and both are based on the ECMAScript Specification. There are some small differences in the actual code such as:

//Actionscript:
var a:String = new PlayerName();

//JavaScript:
var a = new PlayerName();

This is a demonstration that JavaScript does not have explicit variable type declarations, but this is not the real problem.

What you're asking goes much further than syntactic incompatibilities, as JS and AS work with completely different APIs. ActionScript has stages, frames and other Flash-based things which do not exist in JavaScript's environment. JavaScript - usually running in a browser - is used to manipulate documents, DOM nodes and CSS properties.

This means that unless you're just doing simple function calls and mathematics (without any dependency on the user or their environment) the things your program is doing simply cannot be transferred to another environment. For example, you cannot tell JavaScript to play() or goToAndStop() because there are no frames to play, stop or go to in a HTML document.

Unfortunately, I think what you're wondering is valid, but the question is almost certainly incorrect. If you have an application created in Flash or any other AS-enabled environment, you probably want to think about porting or re-writing it to the new context.

Solution 2

You might have a look at Falcon JS: https://github.com/apache/flex-falcon

Share:
13,823
ic2000
Author by

ic2000

I'm an Actionscript 2 Developer, now migrating rrom AS2 to AS3.

Updated on June 04, 2022

Comments

  • ic2000
    ic2000 about 2 years

    I was just wondering is there anyway to convert Actionscript to Javascript. When I say Actionscript I mean Actionscript 3. I've used google swiffy but Actionscript 3 is hardly supported. I've also heard of Jangaroo but its not what I want. Even if its a code comparison! Thanks!

  • Lars Blåsjö
    Lars Blåsjö almost 11 years
    Not sure about the "especially AS3" bit. AS1 was more similar to JavaScript than AS3, and AS2 at least as similar to JavaScript as AS3 is, I would say.
  • ic2000
    ic2000 almost 11 years
    Thanks, i'm sorry but im new to all of this programming stuff so I have no idea how to use it. If could explain how it will be very helpful, thanks!
  • Oliver Salzburg
    Oliver Salzburg about 6 years
    That repo is empty today. Can you provide a new link?