User Guide

190 ActionScript language elements
Availability: ActionScript 1.0; Flash Player 6
Operands
variableName : Object - An identifier for a variable. type A native data type, class name
that you have defined, or interface name.
functionName An identifier for a function.
parameter An identifier for a function parameter.
Example
Usage 1: The following example declares a public variable named
userName whose type is
String and assigns an empty string to it:
var userName:String = "";
Usage 2: The following example shows how to specify a function's parameter type by defining
a function named
randomInt() that takes a parameter named integer of type Number:
function randomInt(integer:Number):Number {
return Math.round(Math.random()*integer);
}
trace(randomInt(8));
Usage 3: The following example defines a function named squareRoot() that takes a
parameter named
val of the Number type and returns the square root of val, also a Number
type:
function squareRoot(val:Number):Number {
return Math.sqrt(val);
}
trace(squareRoot(121));
See also
var statement, function statement
typeof operator
typeof(expression)
Evaluates the expression and returns a string specifying whether the expression is a String,
MovieClip, Object, Function, Number,
or Boolean value.
Availability: ActionScript 1.0; Flash Player 5
Operands
expression : Object - A string, movie clip, button, object, or function.