Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 74

Programming actionscript 3.0
Table of Contents

Advertisement

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
function:
trace()
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. */
74
ActionScript Language and Syntax

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents