What are the key differences between JavaScript and ActionScript 3?

后端 未结 7 2033
孤城傲影
孤城傲影 2020-12-01 05:39

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 t

7条回答
  •  难免孤独
    2020-12-01 05:41

    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:

    • Dynamically and statically typed code
    • Packages, Classes and Interfaces
    • Standard OO inheritance model (not prototype based, statically typed)
    • uint and int datatype
    • E4X (ECMA-357)
    • Type-safe conditional compilation (ES4)
    • Vector. datatype (ES4)

    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.

提交回复
热议问题