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.

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 - The result of the arithmetic operation.<br />

Example<br />

The following example uses the subtraction assignment (-=) operator to subtract 10 from 5<br />

<strong>and</strong> assign the result to the variable x:<br />

var x:Number = 5;<br />

var y:Number = 10;<br />

x -= y; trace(x); // output: -5<br />

The following example shows how strings are converted to numbers:<br />

var x:String = "5";<br />

var y:String = "10";<br />

x -= y; trace(x); // output: -5<br />

See also<br />

- subtraction operator<br />

: type operator<br />

[ modifiers ] var variableName : type<br />

function functionName () : type { ... }<br />

function functionName ( parameter1:type , ... , parameterN:type ) [ :type ]{<br />

... }<br />

Used for strict data typing; this operator specifies the variable type, function return type, or<br />

function parameter type. When used in a variable declaration or assignment, this operator<br />

specifies the variable's type; when used in a function declaration or definition, this operator<br />

specifies the function's return type; when used with a function parameter in a function<br />

definition, this operator specifies the variable type expected for that parameter.<br />

Types are a compile-time-only feature. All types are checked at compile time, <strong>and</strong> errors are<br />

generated when there is a mismatch. Mismatches can occur during assignment operations,<br />

function calls, <strong>and</strong> class member dereferencing using the dot (.) operator. To avoid type<br />

mismatch errors, use strict data typing.<br />

Types that you can use include all native object types, classes <strong>and</strong> interfaces that you define,<br />

<strong>and</strong> Function <strong>and</strong> Void. The recognized native types are Boolean, Number, <strong>and</strong> String. All<br />

built-in classes are also supported as native types.<br />

Operators 163

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

Saved successfully!

Ooh no, something went wrong!