38
ActionScript language elements
true constant
A unique Boolean value that represents the opposite of
false
. When automatic data typing
converts
true
to a number, it becomes 1; when it converts
true
to a string, it becomes
"true"
.
Availability:
ActionScript 1.0; Flash Player 5
Example
The following example shows the use of
true
in an
if
statement:
var shouldExecute:Boolean;
// ...
// code that sets shouldExecute to either true or false goes here
// shouldExecute is set to true for this example:
shouldExecute = true;
if (shouldExecute == true) {
trace("your statements here");
}
// true is also implied, so the if statement could also be written:
// if (shouldExecute) {
// trace("your statements here");
// }
The following example shows how automatic data typing converts
true
to the number 1:
var myNum:Number;
myNum = 1 + true;
trace(myNum); // output: 2
See also
false constant
,
Boolean
undefined constant
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
undefined
. The ActionScript code
typeof(undefined)
returns the string
"undefined"
. The only value of type
undefined
is
undefined
.
In files published for Flash Player 6 or earlier, the value of
String(undefined)
is "" (an
empty string). In files published for Flash Player 7 or later, the value of
String(undefined)
is
"undefined"
(
undefined
is converted to a string).
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...