Flex Data Type

Source: Internet
Author: User
Data Type description

The basic metadata types include Boolean, Int, null, number, String, uint, and void. ActionScript
The core class also defines the following complex data types: object, array, date, error, function, Regexp, XML, and xmllist.


Boolean data type

The boolean data type contains two values:true
Andfalse
. Any other values of the boolean type are invalid. The default value of the declared but uninitialized Boolean variable isfalse
.


Int 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) INTEGER (including-2,147,483,648 and 2,147,483,647 ). In earlier versions, only
Number data type, which can be an integer or a floating point number. Now you can access
A low-end machine type with a signed integer or an unsigned integer. 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. Number data types can be processed
-The value between 9,007,199,254,740,992 and 9,007,199,254,740,992 (53-bit integer. Int
The default value of the data type variable is 0.


NULL 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 containnull
Value. If you try to assign a value to a variable of the Boolean, number, Int, or uint typenull
, Flash player willnull
Convert the value to the default value. The NULL data type cannot be used as a Type comment.


Number Data Type

In ActionScript 3.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 orint
Anduint
Type can store integer values greater than 32 bits. 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
Number of 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. 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 can be stored by the number data type is 21023.
.

The minimum and maximum values that the number type can represent are stored in the name of the number classNumber.MAX_VALUE
AndNumber.MIN_VALUE
.

Number.MAX_VALUE == 1.79769313486231e+308 Number.MIN_VALUE == 4.940656458412467e-324

Despite the large range of numbers, the cost is that the accuracy of the range is reduced. The number data type uses 52 bits to store valid bits. Therefore
A number (such as a score) that can be accurately expressed by a number greater than one digit.
1/3) will only be an approximate value. If the application requires absolute precision for decimal places, you need to use software that implements fractional 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 indicate a value between-9,007,199,254,740,992 (-253
) And 9,007,199,254,740,992 (253
.

Flash Player not onlyNaN
Value usedNumber
The default value of the type variable. It also serves as the result of any operation that should return a number but not a number. For example, if you try to calculate the square root of a negative number, the result isNaN
. Other special number values include "positive infinity" and "negative infinity"

 

Note:

 

When0
When division, if Division is also0
, Then there is only one result, that isNaN
. When0
If the divisor is a positive number, the result isPositive infinity
If the divisor is negative, the result isNegative infinity
.

 


String Data Type

The string data type indicates a 16-Character Sequence. Strings are internally stored as Unicode characters and use UTF-16
Format. A string is an unchangeable value, just like in Java programming language. If you perform an operation on the string value, a new instance of the string is returned. Use string
The default value of the Data Type Declaration variable isnull
. Althoughnull
Value and null string (""
.


Uint Data Type

The uint data type is internally stored as a 32-bit unsigned integer, which contains a group between 0 and 4,294,967,295 (232
-
1) An integer between 0 and 4,294,967,295 ). The uint data type can be used in special cases that require non-negative integers. For example, you must use uint
The data type indicates 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. Use
Number data type, which can process 53-bit integer values. The default value of a uint data type variable is 0.


Void 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 ActionScript 3.0, the default value of an object instance isnull
. If you tryundefined
If an instance is assigned to an object class, Flash Player converts the valuenull
. You can only assignundefined
This value. A non-type variable indicates a lack of Type comments or the use of asterisks (*
. Onlyvoid
Used as a comment on the return type.


Object Data Type

The object data type is defined by the object class. The object class is used as ActionScript.
The base class defined by all classes in. Object Data Type in ActionScript 3.0 and objects in earlier versions
There are three differences between data types: first, the object data type is no longer the default data type specified for variables without type annotations. Second, the object data type is no longer includedundefined
This value is previously the default value of the object instance. Third, in ActionScript 3.0, the default value of the object class instance isnull
.

In earlier versions, the object data type is automatically assigned to variables without type annotations. Event 3.0
Currently, the concept of true no-type variables is included. Therefore, the object is no longer assigned to variables without type annotations.
Data type. Variables without type annotations are now considered as non-type variables. If you want to clearly indicate to the code reader that you intentionally leave the variable as untyped, you can use the new asterisk (*
) Indicates the type comment, which is equivalent to the omitted type comment. The following example shows two equivalent statements, both of which declare a non-type variable.x
:

var x var x:* 

The value can be saved only when there is no type variable.undefined
. If you tryundefined
Assign this value to a variable of data type.undefined
Convert to the default value of the data type. The default value isnull
, Which means that if you tryundefined
Assigned to the object instance, flash player will assign the valueundefined
Convertnull
.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.