Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Actionscript to Javascript

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!

like image 585
ic2000 Avatar asked Aug 15 '13 02:08

ic2000


People also ask

Is JavaScript based on ActionScript?

Adobe® ActionScript® 3.0 is a programming language like JavaScript—both are based on ECMAScript. ActionScript 3.0 was released with Adobe® Flash® Player 9 and you can therefore develop rich Internet applications with it in Adobe® Flash® CS3 Professional, Adobe® Flash® CS4 Professional, and Adobe® Flex™ 3.

Is ActionScript still being used?

(Deprecated with Animate) ActionScript 1.0 is the simplest form of ActionScript, and is still used by some versions of the Adobe Flash Lite Player.

What replaced ActionScript?

Java, TypeScript, JavaScript, HTML5, and Python are the most popular alternatives and competitors to ActionScript.

What language does ActionScript use?

Developed by Macromedia Inc, ActionScript is an object oriented programming language. The language was derived from HyperTalk, which was the scripting language for HyperCard. At present, ActionScript is a dialect of the ECMAScript, more commonly known as JavaScript.


2 Answers

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.

like image 51
Bryce Avatar answered Sep 30 '22 23:09

Bryce


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

like image 38
Christophe Herreman Avatar answered Sep 30 '22 23:09

Christophe Herreman