I know both languages are from the same ECMA-262 standard. It seems that the two are becoming very similar with JavaScript adding event listeners for core Object instances through methods like freeze
and seal
in EMCAScript-262 5th edition and such. I was wondering what the differences are?
Both JavaScript and ActionScript are scripting languages, or interpreted languages. The browser (or Flash) interprets the code at runtime. They are not compiled (like C++ or Java). ActionScript is used in Flash applications, while JavaScript can run on almost any web page.
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.
ActionScript 3 is an object-oriented programming language originally created by Macromedia Inc., which continued to evolve after being acquired by Adobe Systems. It is a superset of the ECMAScript standard (more widely known as JavaScript) with a stronger focus on classes, interfaces, and objects.
It's faster, neater and far more recommended than AS2. The main difference is that you can develop flash applications with a much stronger OOP influence than in AS2. AS3 makes it much easier to utilise third party code such as Greensock's Tweenlite, Papervision 3D and box2d.
First of all ActionScript 3 and JavaScript are both defined in ECMA-262 so they have a lot in common. Both languages feature prototype inheritance for instance. It is however not correct that ActionScript fully implements ES4.
ActionScript implements a couple of features that are not defined in ECMA-262 and some -- but definitely not all -- of ES4.
So what does AS3 add to ECMA-262? Those are also the differences to JavaScript:
Maybe I have forgotten some features. I am not sure if XML, XMLList etc. are already defined in 262 or came with 357.
The key difference however is the standard library. JavaScript comes with a couple of predefined classes like DOMElement and browser dependent additions. ActionScript has a fairly large standard library with features like video streaming and is consistent over all platforms.
I've been programming in both ActionScript and Javascript, and from a less-technical standpoint, I see two main differences.
1) JavaScript is more powerful. You are allowed to do much more with the language because it does not have a "compiler" or types. There are some great frameworks out there like ExtJS and jQuery that try and simplify things for you, but even with them, you are really allowed to do an amazing amount of damage if you want to.
2) ActionScript is much more confining and hence, much easier to maintain. Adobe did a lot of work to keep you out of the difficult parts of ECMAScript. ECMAScript Objects, prototypal inheritance, and closures are three concepts that you really don't need to understand to program in ActionScript. You just need to understand how to use Adobe's "Class" object.
For simple uses, I prefer JavaScript. However, once the project gets large, it depends who you are coding for. If I had a team of 5 developers programming at a scrappy start-up, I'd choose JavaScript in a heartbeat. However, in the girth of a large corporation, or academia, you might be safer relying on Adobe's platform.
Hope that helps.
One is type Safetly. Actionscript requires that you set a type for all objects, and JavaScript doesn't (for that matter, in JavaScript, one variable may be one type and then immediately set to another type).
Actionscript is object oriented. Although you can sort of have this in JavaScript, Actionscript allows for object inheritance, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With