03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Usage 2: The following example evaluates the function foo(), <strong>and</strong> then the function bar(),<br />

<strong>and</strong> returns the result of the expression a + b:<br />

var a:Number = 1;<br />

var b:Number = 2;<br />

function foo() { a += b; }<br />

function bar() { b *= 10; }<br />

trace((foo(), bar(), a + b)); // outputs 23<br />

Usage 3: The following example shows the use of parentheses with functions:<br />

var today:Date = new Date();<br />

trace(today.getFullYear()); // traces current year<br />

function traceParameter(param):Void { trace(param); }<br />

traceParameter(2 * 2); //traces 4<br />

See also<br />

with statement<br />

=== strict equality operator<br />

expression1 === expression2<br />

Tests two expressions for equality; the strict equality (===)operator performs in the same way<br />

as the equality (==) operator, except that data types are not converted. The result is true if<br />

both expressions, including their data types, are equal.<br />

The definition of equal depends on the data type of the parameter:<br />

■ Numbers <strong>and</strong> Boolean values are compared by value <strong>and</strong> are considered equal if they have<br />

the same value.<br />

■ String expressions are equal if they have the same number of characters <strong>and</strong> the characters<br />

are identical.<br />

■ Variables representing objects, arrays, <strong>and</strong> functions are compared by reference. Two such<br />

variables are equal if they refer to the same object, array, or function. Two separate arrays<br />

are never considered equal, even if they have the same number of elements.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Oper<strong>and</strong>s<br />

expression1 : Object - A number, string, Boolean value, variable, object, array, or<br />

function.<br />

expression2 : Object - A number, string, Boolean value, variable, object, array, or<br />

function.<br />

Operators 189

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!