Data Types - Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual

Programming actionscript 3.0
Table of Contents

Advertisement

If you declare a variable, but do not declare its data type, the default data type
which actually means that the variable is untyped. If you also do not initialize an untyped
variable with a value, its default value is
For data types other than Boolean, Number, int, and uint, the default value of any
uninitialized variable is
well as any custom classes that you create.
The value
is not a valid value for variables of type Boolean, Number, int, or uint. If you
null
attempt to assign a value of
value for that data type. For variables of type Object, you can assign a value of
attempt to assign the value
.
null
For variables of type Number, there is a special top-level function named
the Boolean value
true

Data types

A data type defines a set of values. For example, the Boolean data type is the set of exactly two
values:
and
true
false
more commonly used data types, such as String, Number, and Array. You can define your own
data types by using classes or interfaces to define a custom set of values. All values in
ActionScript 3.0, whether they are primitive or complex, are objects.
A primitive value is a value that belongs to one of the following data types: Boolean, int,
Number, String, and uint. Working with primitive values is usually faster than working with
complex values because ActionScript stores primitive values in a special way that makes
memory and speed optimizations possible.
For readers interested in the technical details, ActionScript stores primitive values internally
as immutable objects. The fact that they are stored as immutable objects means that
passing by reference is effectively the same as passing by value. This cuts down on memory
usage and increases execution speed because references are usually significantly smaller
than the values themselves.
A complex value is a value that is not a primitive value. Data types that define sets of complex
values include Array, Date, Error, Function, RegExp, XML, and XMLList.
undefined
. This applies to all the classes defined by the Flash Player API, as
null
to a such a variable, the value is converted to the default
null
to a variable of type Object, the value is converted to
undefined
if the variable is not a number, and
. In addition to the Boolean data type, ActionScript 3.0 defines several
.
isNaN()
otherwise.
false
will apply,
*
. If you
null
that returns

Data types

55

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents