Type Operator - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Example
The following example uses the subtraction assignment (
and assign the result to the variable
var x:Number = 5;
var y:Number = 10;
x -= y; trace(x); // output: -5
The following example shows how strings are converted to numbers:
var x:String = "5";
var y:String = "10";
x -= y; trace(x); // output: -5
See also
- subtraction operator

: type operator

[ modifiers ] var variableName : type
function functionName () : type { ... }
function functionName ( parameter1:type , ... , parameterN:type ) [ :type ]{
... }
Used for strict data typing; this operator specifies the variable type, function return type, or
function parameter type. When used in a variable declaration or assignment, this operator
specifies the variable's type; when used in a function declaration or definition, this operator
specifies the function's return type; when used with a function parameter in a function
definition, this operator specifies the variable type expected for that parameter.
Types are a compile-time-only feature. All types are checked at compile time, and errors are
generated when there is a mismatch. Mismatches can occur during assignment operations,
function calls, and class member dereferencing using the dot (
mismatch errors, use strict data typing.
Types that you can use include all native object types, classes and interfaces that you define,
and Function and Void. The recognized native types are Boolean, Number, and String. All
built-in classes are also supported as native types.
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
variableName :
Object
that you have defined, or interface name.
An identifier for a function parameter.
parameter
176
ActionScript language elements
:
x
- An identifier for a variable.
functionName
operator to subtract 10 from 5
-=)
) operator. To avoid type
.
A native data type, class name
type
An identifier for a function.

Advertisement

Table of Contents
loading

Table of Contents