Question

This question already has an answer here:

I have a book, Essential ActionScript 3 (O'Reilly), to learn about using that language. It mentions that ActionScript 3 is an implementation of ECMAScript, just like Javascript. I find this strange, because there are many differences. In Javascript, as far as I know, you cannot give variables a type (var marvin : Robot) or create "traditional" classes and interfaces. This is, however, possible in ActionScript.

What's up?

Was it helpful?

Solution

The current implementations of Javascript in browser follows Ecmascript 3 specification. Actionscript implements Ecmascript 3 but in addition, some of the elements in Ecmascript 4 draft specification (at that time). ES4 features Classes, classical inheritance, packages and other features you see in AS3.

ES4 is now abandoned but here is a link to the specs PDF.

OTHER TIPS

ActionScript 1 (Flash Player 5 and 6) is very close to JavaScript.

Wikipedia's page about ECMAScript states (quoting) :

ECMAScript is a scripting language, standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262. The language is widely used on the web, especially in the form of its three best-known dialects, JavaScript, ActionScript, and JScript.

So I'm guessing that those three languages sort-of are "children" of ECMAScript, and that each of those choose to implement (or not) some specific features -- while all keeping the same root.


The page about ActionScript kind of confirms that, stating (quoting, emphasis mine) :

ActionScript is a scripting language based on ECMAScript.

I suppose this "based on" is the important part.


Also, there might be a difference depending on the version of ECMAScript that is used, I'd say -- especially considering people are talking about ECMAScript 5, and that, for instance, Javascript is based on ECMAScript 3 :

As of 2009, the latest version of the language is JavaScript 1.8.1. It is a superset of ECMAScript (ECMA-262) Edition 3.

ECMAScript is just a standard for a scripting language. Javascript and Actionscript are both implementations of that standard. Each implementation may or may not strictly follow that standard, and both are free to add to and subtract from it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top