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 " + ", not vanilla.");
}
This code is equivalent to the following slightly more verbose code:
flavor = getIceCreamFlavor();
if (flavor != "vanilla") {
trace ("Flavor was " + ", 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
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...