Macromedia Flash MX 2004 ActionScript Programming Tutorial

Expressions

An expression is code that produces a single value. You’ve seen that you can concatenate strings using the plus sign (+). The plus sign is actually an addition operator that’s used to combine values. If those values are strings, the text is joined together to form one string. If the values are numerical, the numbers are added together, resulting in one number, the sum. The code that produces these results is called an expression.

We also noted some numeric operators that can be used to calculate number variables, including the subtraction (-), multiplication (*), division (/), modulo (%), increment (++), and decrement (–) operators. Below is a table containing these and some additional ActionScript operators used for Flash Players 5 and later.

+

Addition

Subtraction

*

Multiplication

/

Division

%

Modulo (remainder of division)

++

Increment

Decrement

=

Equals (numeric operator used to assign variables, properties, methods, etc.)

==

Is equal to (comparison operator used to compare values)

===

Is equal to (comparison operator used to compare non-string values and their data types)

!=

Is not equal to (comparison operator used to compare values)

<

Less than (comparison operator used to compare values)

>

Greater than (comparison operator used to compare values)

<=

Less than or equal to (comparison operator used to compare values)

>=

Greater than or equal to (comparison operator used to compare values)

&&

AND (logical operator that returns TRUE if both operands are true)

||

OR (logical operator that returns TRUE if the left or right operand is true)

!

NOT (logical operator that returns the Boolean opposite of the operand following the ! operator)

You’ll see operators in use throughout the tutorial.

One Comment

  1. zoe

Leave a Reply

Your email address will not be published. Required fields are marked *