User Guide
Operators 167
The following example illustrates comparison by reference with two functions:
var a:Function = function() { trace("foo"); };
var b:Function = function() { trace("foo"); };
a(); // foo
b(); // foo
trace(a != b); // true
a = b;
a(); // foo
b(); // foo
trace(a != b); // false
// trace statement output: foo foo true foo foo false
The following example illustrates comparison by reference with two arrays:
var a:Array = [ 1, 2, 3 ];
var b:Array = [ 1, 2, 3 ];
trace(a); // 1, 2, 3
trace(b); // 1, 2, 3
trace(a!=b); // true
a = b;
trace(a); // 1, 2, 3
trace(b); // 1, 2, 3
trace(a != b); // false
// trace statement output: 1,2,3 1,2,3 true 1,2,3 1,2,3 false
See also
! logical NOT operator, !== strict inequality operator, && logical AND
operator
, || logical OR operator, == equality operator, === strict equality
operator
<> inequality operator
expression1 <> expression2
Deprecated since Flash Player 5. This operator has been deprecated. Macromedia
recommends that you use the
!= (inequality) operator.
Tests for the exact opposite of the equality (==) operator. If expression1 is equal to
expression2, the result is false. As with the equality (==)operator, the definition of equal
depends on the data types being compared:
■ Numbers, strings, and Boolean values are compared by value.
■ Objects, arrays, and functions are compared by reference.
■ Variables are compared by value or by reference depending on their type.
Availability: ActionScript 1.0; Flash Player 2