本文介绍了JavaScript 和 ActionScript 3 之间的主要区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这两种语言都来自同一个 ECMA-262 标准.似乎两者变得非常相似,JavaScript 通过 EMCAScript-262 第 5 版中的 freezeseal 等方法为核心 Object 实例添加事件侦听器.我想知道有什么区别?

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?

推荐答案

首先,ActionScript 3 和 JavaScript 都定义在 ECMA-262 所以它们有很多共同点.例如,两种语言都具有原型继承功能.然而,ActionScript 完全实现 ES4.

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 实现了一些 ECMA-262 中未定义的功能,以及 ES4 中的一些(但绝对不是全部).

ActionScript implements a couple of features that are not defined in ECMA-262 and some -- but definitely not all -- of ES4.

那么,AS3 为 ECMA-262 添加了什么?这些也是与 JavaScript 的区别:

So what does AS3 add to ECMA-262? Those are also the differences to JavaScript:

  • 动态和静态类型代码
  • 包、类和接口
  • 标准的 OO 继承模型(不是基于原型的,静态类型的)
  • uint 和 int 数据类型
  • E4X (ECMA-357)
  • 类型安全的条件编译 (ES4)
  • 矢量.数据类型 (ES4)

也许我忘记了一些功能.我不确定 XML、XMLList 等是否已经在 262 或 357 中定义.

Maybe I have forgotten some features. I am not sure if XML, XMLList etc. are already defined in 262 or came with 357.

然而,关键的区别在于标准库.JavaScript 带有几个预定义的类,如 DOMElement 和浏览器相关的附加项.ActionScript 有一个相当大的标准库,其中包含视频流等功能,并且在所有平台上都是一致的.

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.

这篇关于JavaScript 和 ActionScript 3 之间的主要区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-23 14:45