Flex data type description
The basic metadata types include Boolean, Int, null, number, String, uint, and void. The ActionScript core class also defines the following complex data types: object, array, date, error, function, Regexp, XML, and xmllist.
◆ Boolean data type
Boolean data types include true and false. Any other values of the boolean type are invalid. The default value of a declared but uninitialized Boolean variable is false.
◆ Int Data Type
In the flex data type, the int data type is internally stored as a 32-bit integer, which contains a group between-2,147,483,648 (-231) and 2,147,483,647 (231-1) an integer between-2,147,483,648 and 2,147,483,647 ). In earlier versions of ActionScript, only the number data type was provided. This data type can be used for both integers and floating point numbers. In actionscript3.0, you can now access a 32-bit low-end Machine Type with signed integers and unsigned integers. If your variables do not use floating-point numbers, using the int data type instead of the number data type should be faster and more efficient.
The number data type should be used for integer values smaller than the minimum value of Int or greater than the maximum value of Int. The number data type can process values between-9,007,199,254,740,992 and 9,007,199,254,740,992 (53-bit integer. The default value of the int data type variable is 0.
◆ NULL data type
In the flex data type, the NULL data type contains only one value: null. This is the default value for the string data type and all classes (including object classes) used to define complex data types. Other basic metadata types (such as Boolean, number, Int, and uint) do not contain null values. If you try to assign null to a variable of the Boolean, number, Int, or uint type, flashplayer converts the null value to the default value. The NULL data type cannot be used as a Type comment.
◆ Number data type
In actionscript3.0, the number data type can be an integer, an unsigned integer, or a floating point number. However, to improve performance as much as possible, the number data type should be used only for floating point numbers or integer values larger than 32 bits that can be stored for int and uint types. To store floating-point numbers, the number should contain a decimal point. If you omit the decimal point, the number is stored as an integer.
The number data type uses a 64-bit double-precision format specified by the IEEE binary floating point Arithmetic standard (IEEE-754. This Standard specifies how to use 64 available bits to store floating point numbers. The first digit specifies whether the number is positive or negative. 11 bits are used for index storage in binary format. The remaining 52 bits are used to store "valid digits" (also known as "tails"). The valid bits are the N power of 2, and N is the index mentioned above.
All the bits of the number data type can be used for the valid bits, or some bits of the number data type can be used for the storage index. The latter can store a larger floating point number than the former. For example, if the number data type uses all 64-bit to store valid digits, the maximum number it can store is 265-1. If the 11-digit index is used to store the index, the maximum valid number that the number data type can store is 21023.
The minimum and maximum values that the number type can represent are stored in the static attributes named number. max_value and number. min_value of the number class.
Number. max_value = 1.79769313486231e + 308number. min_value = 4.940656458412467e-324 although this number range is large, the cost is that the accuracy of this range is reduced. The number data type uses 52 bits to store valid bits. Therefore, those that require more than 52 bits (such as a score of 1/3) are only approximate values. If the applicationProgramTo ensure absolute precision of decimal places, you must use a software that implements decimal Floating Point Arithmetic (rather than binary floating point Arithmetic.
If the number data type is used to store integer values, only 52 valid digits are used. The number data type uses 52 bits and a special hidden bits to represent integers between-9,007,199,254,740,992 (-253) and 9,007,199,254,740,992 (253.
Flash Player not only uses the Nan value as the default value of the number type variable, but also uses it as the result of any operation that returns a number but does not return a number. For example, if you try to calculate the square root of a negative number, the result will be Nan. Other special number values include "positive infinity" and "negative infinity ".
Note:
If the divisor is 0, there is only one result, that is, Nan. If the divisor is positive when it is divided by 0, the result is positive infinity. If the divisor is negative, the result is negative infinity.
◆ String data type
The string data type indicates a 16-Character Sequence. Strings are internally stored as Unicode characters and in UTF-16 format. The string is an unchangeable value, just like in JavaProgramming Language. If you perform an operation on the string value, a new instance of the string is returned. The default value of the variable declared with the string data type is null. Although the null value and the Null String ("") both indicate that there are no characters, they are not the same.
◆ Uint Data Type
The uint data type is internally stored as a 32-bit unsigned integer, which contains a group of Integers (including 0 and 4,294,967,295) between 0 and 232 (4,294,967,295-1 ). The uint data type can be used in special cases that require non-negative integers. For example, the uint data type must be used to represent the pixel color value. Because the int data type has an internal symbol bit, this symbol bit is not suitable for processing the color value. For integer values greater than the maximum value of uint, the number data type should be used, which can process 53-bit integer values. The default value of a uint data type variable is 0.
◆ Void Data Type
In the flex data type, the void data type contains only one value: undefined. In earlier versions of ActionScript, undefined is the default value of the object class instance. In actionscript3.0, the default value of the object instance is null. If you try to assign the value undefined to the instance of the object class, flashplayer converts the value to null. You can only assign the undefined value to a non-type variable. A non-type variable is a variable that lacks a type comment or uses an asterisk (*) as a Type comment. You can only use void as the return type comment.
◆ Object Data Type
The object data type is defined by the object class. The object class is used as the base class defined by all classes in ActionScript. There are three differences between the object data type in actionscript3.0 and the Object Data Type in earlier versions: first, the object data type is no longer the default data type specified for variables without type annotations. Second, the object data type does not include the undefined value. This value was previously the default value of the object instance. Third, in actionscript3.0, the default value of the object class instance is null.
In earlier versions, the object data type is automatically assigned to variables without type annotations. Actionscript3.0 currently includes the concept of true no-type variables. Therefore, the object data type is no longer assigned to variables without type annotations. Variables without type annotations are now considered as non-type variables. If you wantCodeThe reader clearly indicates that you intentionally keep the variable as untyped. You can use the new asterisk (*) to indicate the type comment, which is equivalent to omitting the type comment. The following example shows two equivalent statements, both of which declare a non-type variable X:
Varx
Varx :*
The undefined value can be saved only when there is no type variable. If you try to assign the value undefined to a variable of the Data Type, flashplayer converts the value undefined to the default value of the data type. For an instance of the object data type, the default value is null, which means that if you try to assign undefined to the object instance, flashplayer will convert the value undefined to null.