Instanceof - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

instanceof

Availability
Flash Player 6.
Usage
object instanceof class
Parameters
An ActionScript object.
object
A reference to an ActionScript constructor function, such as String or Date.
class
Returns
If
is an instance of
object
instanceof Object
Description
Operator; determines whether an object belongs to a specified class. Tests whether
instance of
class
The
instanceof
following code returns
new String("Hello") instanceof String;
The following code returns
"Hello" instanceof String;
Example
In the following example, a
TextInput component instances. The instance names appear in the output.
for (var i in this) {
if (this[i] instanceof mx.controls.TextInput) {
trace("Instance \""+i+"\" is a TextInput component instance.");
}
}
See also
typeof
334
Chapter 2: ActionScript Language Reference
,
class
instanceof
returns
.
false
.
operator does not convert primitive types to wrapper objects. For example, the
:
true
:
false
loop is used to loop through the SWF file and trace only
for
ActionScript Language Reference
returns
;
true
false
CHAPTER 2
otherwise. Also,
_global
is an
object

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents