Typeof 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
Usage 1: The following example declares a public variable named
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()
function randomInt(integer:Number):Number {
return Math.round(Math.random()*integer);
}
trace(randomInt(8));
Usage 3: The following example defines a function named
parameter named
val
type:
function squareRoot(val:Number):Number {
return Math.sqrt(val);
}
trace(squareRoot(121));
See also
,
var statement
function statement

typeof operator

typeof(expression)
The
operator evaluate the
typeof
expression is a
String, MovieClip, Object, Function, Number,
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
expression :
Object
Returns
- A
representation of the type of
String
String
results of the
typeof
Expression Type
String
Movie clip
that takes a parameter named
of the Number type and returns the square root of
expression
- A string, movie clip, button, object, or function.
operator on each type of
integer
squareRoot()
and returns a string specifying whether the
. The following table shows the
expression
.
expression
Result
string
movieclip
whose type is
userName
of type Number:
that takes a
, also a Number
val
or
value.
Boolean
Operators
177

Advertisement

Table of Contents
loading

Table of Contents