User Guide
74 ActionScript Language and Syntax
Parentheses
You can use parentheses (()) in three ways in ActionScript 3.0. First, you can use parentheses
to change the order of operations in an expression. Operations that are grouped inside
parentheses are always executed first. For example, parentheses are used to alter the order of
operations in the following code:
trace(2 + 3 * 4); // 14
trace( (2 + 3) * 4); // 20
Second, you can use parentheses with the comma operator (,) to evaluate a series of
expressions and return the result of the final expression, as shown in the following example:
var a:int = 2;
var b:int = 3;
trace((a++, b++, a+b)); // 7
Third, you can use parentheses to pass one or more parameters to functions or methods, as
shown in the following example, which passes a String value to the
trace() function:
trace("hello"); // hello
Comments
ActionScript 3.0 code supports two types of comments: single-line comments and multiline
comments. These commenting mechanisms are similar to the commenting mechanisms in
C++ and Java. The compiler will ignore text that is marked as a comment.
Single-line comments begin with two forward slash characters (
//) and continue until the end
of the line. For example, the following code contains a single-line comment:
var someNumber:Number = 3; // a single line comment
Multiline comments begin with a forward slash and asterisk (/*) and end with an asterisk and
forward slash (
*/).
/* This is multiline comment that can span
more than one line of code. */