Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Data and Data Types > About data types > About primitive and complex data types | |||
You can divide all the different data type values into two main categories: primitive or complex.
A primitive value (or primitive data type) is a value that ActionScript stores at the lowest level of abstraction, which means that operations on the primitive data types are generally faster and more efficient than operations carried out on complex data types. The following data types all define a set of one or more primitive values: Boolean, null, Number, String, and undefined.
A complex value (or complex data type) is a value that is not a primitive value and that references the primitive values. Often, these are called reference data types. Complex values belong to the Object data type or a data type that is based on the Object data type. Data types that define sets of complex values include Array, Date, Error, Function, and XML. For more information on these complex data types, see their entries in the ActionScript 2.0 Language Reference.
Variables that contain primitive data types behave differently in certain situations than those containing complex types. For more information, see Using variables in a project.
ActionScript has the following basic data types that you can use in your applications:
|
Data type |
Description |
|---|---|
|
Boolean |
Primitive. The Boolean data type consists of two values: |
|
MovieClip |
Complex. The MovieClip data type lets you control movie clip symbols using the methods of the MovieClip class. For more information, see MovieClip data type. |
|
null |
Primitive. The null data type contains the value |
|
Number |
Primitive. This data type can represent integers, unsigned integers, and floating point numbers. To store a floating point number, you should include a decimal point in the number. Without the decimal point, the number is stored as an integer. The Number data type can store values from |
|
Object |
Complex. The Object data type is defined by the Object class. The Object class serves as the base class for all class definitions in ActionScript, and it lets you arrange objects inside each other (nested objects). For more information, see Object data type. |
|
String |
Primitive. The String data type represents a sequence of 16-bit characters that might include letters, numbers, and punctuation marks. Strings are stored as Unicode characters, using the UTF-16 format. An operation on a String value returns a new instance of the string. For more information, see String data type. |
|
undefined |
Primitive. The undefined data type contains one value: |
|
Void |
Complex. The Void data type contains only one value: |
For a sample of the datatypes.fla file, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/DataTypes folder to access the sample.
Flash CS3