undefined
Availability
Flash Player 5.
Usage
undefined
Parameters
None.
Returns
Nothing.
Description
A special value, usually used to indicate that a variable has not yet been assigned a value. A
reference to an undefined value returns the special value
typeof(undefined)
is
.
undefined
In files published for Flash Player 6 or earlier, the value of
"" (an empty string). In files published for Flash Player 7 or later, the value of
undefined.toString()
The value
undefined
compared with the equality operator, they compare as equal.
Example
In this example, the variable
the first section of code, the equality operator (
and the appropriate result is sent to the Output panel. In the second section of code,
undefined
the equality operator compares the values
// x has not been declared
trace ("The value of x is " + x);
if (x == undefined) {
trace ("x is undefined");
} else {
trace ("x is not undefined");
}
trace ("typeof (x) is " + typeof (x));
if (null == undefined) {
trace ("null and undefined are equal");
} else {
trace ("null and undefined are not equal");
}
The following result is displayed in the Output panel.
The value of x is undefined
x is undefined
typeof (x) is undefined
null and undefined are equal
740
Chapter 12: ActionScript Dictionary
returns the string
"undefined"
is
.
undefined
is similar to the special value
has not been declared and therefore has the value
x
null
. The ActionScript code
undefined
. The only value of type
undefined.toString()
. When
null
null
) compares the value of
==
and
.
undefined
undefined
is
and
are
undefined
. In
undefined
to the value
x
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?