EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 48

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
48 Chapter 2: ActionScript Basics
The strict equality (===) operator is like the equality operator, with one important difference: the
strict equality operator does not perform type conversion. If the two operands are of different
types, the strict equality operator returns
false. The strict inequality (!==) operator returns the
inversion of the strict equality operator.
The following table lists the ActionScript equality operators:
Assignment operators
You can use the assignment (
=) operator to assign a value to a variable, as shown in the
following example:
var password = "Sk8tEr";
You can also use the assignment operator to assign multiple variables in the same expression. In
the following statement, the value of
a is assigned to the variables b, c,and d:
a = b = c = d;
You can also use compound assignment operators to combine operations. Compound operators
perform on both operands and then assign the new value to the first operand. For example, the
following two statements are equivalent:
x += 15;
x = x + 15;
The assignment operator can also be used in the middle of an expression, as shown in the
following example:
// If the flavor is not vanilla, output a message.
if ((flavor = getIceCreamFlavor()) != "vanilla") {
trace ("Flavor was " + flavor + ", not vanilla.");
}
This code is equivalent to the following slightly more verbose code:
flavor = getIceCreamFlavor();
if (flavor != "vanilla") {
trace ("Flavor was " + flavor + ", not vanilla.");
}
The following table lists the ActionScript assignment operators:
Operator Operation performed
==
Equality
===
Strict equality
!=
Inequality
!==
Strict inequality
Operator Operation performed
=
Assignment
+=
Addition and assignment
-=
Subtraction and assignment
*=
Multiplication and assignment

Table of Contents

Related product manuals