User Guide

988 Chapter 2: ActionScript Language Reference
typeof
Availability
Flash Player 5.
Usage
typeof(expression) : String
Parameters
expression
A string, movie clip, button, object, or function.
Description
Operator; a unary operator placed before a single parameter. The typeof operator causes the
Flash interpreter to evaluate
expression; the result is a string specifying whether the expression is
a string, movie clip, object, function, number, or Boolean value. The following table shows the
results of the
typeof operator on each type of expression:
nu
Example
In the following example, all instances in a SWF file and their types are traced and displayed in
the Output panel.
for (i in _root) {
trace("_root."+i+" ("+typeof (_root[i])+")");
}
Parameter Output
String
string
Movie clip
movieclip
Button
object
Text field
object
Number
number
Boolean
boolean
Object
object
Function
function
null
null
undefined
undefined
CHAPTER 2
ActionScript Language Reference