Data structures
[edit]Data types
ActionScript primarily consists of "fundamental" or "simple" data types which are used to create other data types. These data types are very similar to Java data types. Since ActionScript 3 was a complete rewrite of ActionScript 2, the data types and their inheritances have changed.
ActionScript 2 top level data types
• String - A list of characters such as "Hello World"
• Number - Any Numeric value
• Boolean - A simple binary storage that can only be "true" or "false".
• Object - Object is the data type all complex data types inherit from. It allows for the grouping of methods, functions, parameters, and other objects.
ActionScript 2 complex data types
There are additional "complex" data types. These are more processor and memory intensive and consist of many "simple" data types. For AS2, some of these data types are:
• MovieClip - An ActionScript creation that allows easy usage of visible objects.
• TextField - A simple dynamic or input text field. Inherits the Movieclip type.
• Button - A simple button with 4 frames (states): Up, Over, Down and Hit. Inherits the MovieClip type.
• Date - Allows access to information about a specific point in time.
• Array - Allows linear storage of data.
• XML - An XML object
• XMLNode - An XML node
• LoadVars - A Load Variables object allows for the storing and send of HTTP POST and HTTP GET variables
• Sound
• NetStream
• NetConnection
• MovieClipLoader
• EventListener
ActionScript 3 primitive (prime) data types (see Data type descriptions)
• Boolean - The Boolean data type has only two possible values: true and false or 1 and 0. No other values are valid.
• int - The int data type is a 32-bit integer between -2,147,483,648 and 2,147,483,647.
• Null - The Null data type contains only one value, null. This is the default value for the String data type and all classes that define complex data types, including the Object class.
• Number - The Number data type can represent integers, unsigned integers, and floating-point numbers. The Number data type uses the 64-bit double-precision format as specified by the IEEE Standard for Binary Floating-Point Arithmetic (IEEE-754). values between -9,007,199,254,740,992 (-253) to 9,007,199,254,740,992 (253) can be stored.
• String - The String data type represents a sequence of 16-bit characters. Strings are stored internally as Unicode characters, using the UTF-16 format. Previous versions of Flash used the UTF-8 format.
• uint - The uint (Unsigned Integer) data type is a 32-bit unsigned integer between 0 and 4,294,967,295.
• void - The void data type contains only one value, undefined. In previous versions of ActionScript, undefined was the default value for instances of the Object class. In ActionScript 3.0, the default value for Object instances is null.
ActionScript 3 some complex data types (see Data type descriptions)
• Object - The Object data type is defined by the Object class. The Object class serves as the base class for all class definitions in ActionScript. Objects in their basic form can be used as associative arrays that contain key-value pairs, where keys are Strings and values may be any type.
• Array - Contains a list of data. Though ActionScript 3 is a strongly typed language, the contents of an Array may be of any type and values must be cast back to their original type after retrieval. (Support for typed Arrays has recently been added with the Vector class.)
• Vector - A variant of array supported only when publishing for Flash Player 10 or above. Vectors are typed, dense Arrays (values must be defined or null) which may be fixed-length, and are bounds-checked during retrieval. Vectors are not just more typesafe than Arrays but also perform faster.
• flash.utils:Dictionary - Dictionaries are a variant of Object that may contain keys of any data type (whereas Object always uses strings for its keys).
• flash.display:Sprite - A display object container without a timeline.
• flash.display:MovieClip - Animated movie clip display object; Flash timeline is, by default, a MovieClip.
• flash.display:Bitmap - A non-animated bitmap display object.
• flash.display:Shape - A non-animated vector shape object.
• flash.utils:ByteArray - Contains an array of binary byte data.
• flash.text:TextField - A dynamic, optionally interactive text field object.
• flash.display:SimpleButton - A simple interactive button type supporting "up", "over", and "down" states with an arbitrary hit area.
• Date - A date object containing the date/time digital representation.
• Error - A generic error object that allows runtime error reporting when thrown as an exception.
• Function - The core class for all Flash method definitions.
• RegExp - A regular expression object for strings.
• flash.media:Video - A video playback object supporting direct (progressive download) or streaming (RTMP) transports. As of Flash Player version 9.0.115.0, the H.264/MP4 high-definition video format is also supported alongside standard Flash video (FLV) content.
• XML - A revised XML object based on the E4X (Standard ECMA-357); nodes and attributes are accessed differently from ActionScript 2.0 object (a legacy class named XMLDocument is provided for backwards compatibility).
• XMLList - An array-based object for various content lookups in the XML class.
数据结构
[编辑]数据类型
动作主要包括“基本”或“简单”这是用来创建其他数据类型的数据类型。这些数据类型到Java的数据类型非常相似。由于ActionScript 3是一个完全重写的动作,数据类型和他们的遗产。
ActionScript 2的最高级别的数据类型
•字符串 - 一个列表中的“Hello World”
号码 - 任何数值
•布尔 - 一个简单的二进制存储,只能是“真”或“假”。
•对象 - 对象的数据类型的字符,比如复杂的数据类型继承。它允许的分组的方法,功能,参数,和其它的目的。
2动作的复杂的数据类型
有额外的“复杂的”的数据类型。这是更多的处理器和内存密集型,包括许多“简单”的数据类型。 AS2,这些数据类型是:影片剪辑 - 一个动作创作可见的对象,可以方便地使用。
•文本字段 - 一个简单的动态或输入文本字段。继承了MovieClip类型。
•按钮 - 4张(州):一个简单的按钮,以上,下和命中。继承的movieclip类型。
•日期 - 允许访问一个特定的时间点。
•阵列信息 - 允许线性存储的数据。
•XML - 一个XML对象
•XMLNode - 一个xml节点
•的LoadVars - 负载变量对象允许存储发送HTTP POST和HTTP GET变量
•声音
•的NetStream
•的NetConnection
•的MovieClipLoader
•EventListener的
ActionScript 3的原语(素数)的数据类型(数据类型描述)
•布尔 - 布尔数据类型只有两种可能的值:true和false或1和0。没有其他的值是有效的。•INT - int数据类型是一个32位的整数,从-2,147,483,648到2,147,483,647。
•空 - 空数据类型仅包含一个值,则返回null。这是字符串数据类型和定义复杂的数据类型,包括对象类的所有类的默认值。
•数字 - 数字数据类型可以表示整数,无符号整数和浮点数。数字数据类型使用由IEEE标准的二进制浮点运算(IEEE-754)指定的64位双精度格式。值之间-9,007,199254740992(-253)可以存储9,007,199,254,740,992(253)。
•字符串 - 字符串数据类型表示一个16位字符的序列。在内部存储为字符串的Unicode字符,使用UTF-16格式。以前版本的Flash使用的是UTF-8格式。
•UINT - UINT(无符号整数)数据类型是一个32位的无符号整数介于0和4294967295。
•无效 - void数据类型仅包含一个值:undefined。在以前版本的ActionScript中,不确定的是对象类的实例的默认值。在ActionScript 3.0中,对象实例的默认值是null。)
ActionScript 3的一些复杂的数据类型(数据类型描述对象 - 对象的数据类型定义的对象类。作为在ActionScript中定义的所有类的基类的对象类。其基本形式中的对象可以被用来作为关联数组包含键 - 值对,其中键是字符串,值可以是任何类型。
•数组 - 包含列表中的数据。虽然ActionScript 3是一种强类型语言,数组的内容可以是任何类型的值必须被转换回原来的类型后检索。 (类型的数组的支持,最近被添加的向量类)。
•矢量 - 阵列的一个变种只支持发布为Flash Player 10或以上版本。向量类型,密集阵列(值必须定义或为空),这可能是固定长度,和边界检查过程中检索。载体不只是比数组更多类型安全的,但也执行得更快。
•flash.utils:字典 - 字典的对象可能包含的任何数据类型的键(而对象总是使用的字符串其键),是一个变种。
•闪光灯。显示:精灵 - 显示对象容器没有一个时间表。
•flash.display:影片剪辑 - 动画影片剪辑显示对象,Flash时间轴中,默认情况下,一个影片剪辑。
•flash.display:位图 - 非动画位图显示对象。
•flash.display:形状 - 一个非动画的矢量形状对象。 •flash.utils:ByteArray中 - 包含一个数组的二进制字节数据的flash.text:文本字段 - 一个充满活力,可选的交互式文本字段对象。
flash.display:SimpleButton的 - 一个简单的交互式按钮类型支持的任意灾区“上升”,“过”和“向下”状态。日 - 约会对象,它包含的数字表示的日期/时间。
•错误 - 一个通用的错误对象,允许运行时错误报告时,抛出一个例外。
•功能 - 所有闪光法定义的核心类。
正则表达式的字符串 - 正则表达式对象。使用flash.media:视频 - 视频播放对象支持直接的(渐进式下载)或流(RTMP)运输。的Flash播放器版本9.0.115.0,h.264/mp4高清晰度视频格式也支持标准的Flash视频(FLV)的含量旁边。•XML - 一个修改后的XML对象的基础上的E4X(标准ECMA-357) ;ActionScript 2.0中的对象(类XmlDocument是用于向后兼容的遗产)不同的节点和属性的访问XMLList - 一个基于阵列的XML类的各种内容中查找对象。
正在翻譯中..
