var y:String = "steve";
trace(x == y);
// output: false
The following examples show comparison by reference. The first example compares two arrays
with identical length and elements. The equality operator will return
for these two arrays.
false
Although the arrays appear equal, comparison by reference requires that they both refer to the
same array. The second example creates the
variable, which points to the same array
thirdArray
as the variable
. The equality operator will return
for these two arrays because
firstArray
true
the two variables refer to the same array.
var firstArray:Array = new Array("one", "two", "three");
var secondArray:Array = new Array("one", "two", "three");
trace(firstArray == secondArray);
// will output false
// Arrays are only considered equal
// if the variables refer to the same array.
var thirdArray:Array = firstArray;
trace(firstArray == thirdArray);
// will output true
See also
! (logical
NOT),
!=
(inequality),
!== (strict
inequality),
&& (logical
AND),
|| (logical
OR),
===
(strict equality)
82
Chapter 2: ActionScript Language Reference
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers