03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - 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.

- subtraction operator<br />

(Negation) -expression<br />

(Subtraction) expression1 - expression2<br />

Used for negating or subtracting.<br />

Usage 1: When used for negating, it reverses the sign of the numerical expression. Usage 2:<br />

When used for subtracting, it performs an arithmetic subtraction on two numerical<br />

expressions, subtracting expression2 from expression1. When both expressions are<br />

integers, the difference is an integer. When either or both expressions are floating-point<br />

numbers, the difference is a floating-point number.<br />

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

expression1 : Number - A number or expression that evaluates to a number.<br />

expression2 : Number - A number or expression that evaluates to a number.<br />

Returns<br />

Number - An integer or floating-point number.<br />

Example<br />

Usage 1: The following statement reverses the sign of the expression 2 + 3:<br />

trace(-(2+3)); // output: -5<br />

Usage 2: The following statement subtracts the integer 2 from the integer 5:<br />

trace(5-2); // output: 3<br />

The result, 3, is an integer. Usage 3: The following statement subtracts the floating-point<br />

number 1.5 from the floating-point number 3.25:<br />

trace(3.25-1.5); // output: 1.75<br />

The result, 1.75, is a floating-point number.<br />

-= subtraction assignment operator<br />

expression1 -= expression2<br />

Assigns expression1 the value of expression1- expression2. For example, the following<br />

two statements are equivalent:<br />

x -= y ; x = x - y;<br />

String expressions must be converted to numbers; otherwise, NaN (not a number) is returned.<br />

162 ActionScript language elements

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

Saved successfully!

Ooh no, something went wrong!