Data types

A data type describes the kind of information a variable or ActionScript element can hold. There are two kinds of data types built into Flash: primitive and reference. The primitive data types—String, Number, and Boolean—have a constant value and therefore can hold the actual value of the element they represent. The reference data types—MovieClip and Object—have values that can change and therefore contain references to the actual value of the element. Variables containing primitive data types behave differently in certain situations than those containing reference types. (See Using variables in a program.) There are also two special data types: null and undefined.

In Flash, any built-in object that isn't a primitive data type or a movie clip data type, such as Array or Math, is of the Object data type.

Each data type has its own rules and is described in the following topics:

When you debug scripts, you may need to determine the data type of an expression or variable to understand why it is behaving a certain way. You can do this with the typeof operator (see Determining an item's data type).

You can convert one data type to another using one of the following conversion functions: Array(), Boolean(), Number(), Object(), String().