Flash Player 6.
object instanceof class
object An ActionScript object.
class A reference to an ActionScript constructor function, such as String or Date.
If object is an instance of class, instanceof returns true; false otherwise. Also, _global instanceof Object returns false.
Operator; determines whether an object belongs to a specified class. Tests whether object is an instance of class.
The instanceof operator does not convert primitive types to wrapper objects. For example, the following code returns true:
new String("Hello") instanceof String;
The following code returns false:
"Hello" instanceof String;
In the following example, a for loop is used to loop through the SWF file and trace only 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.");
}
}
typeof
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001371.html
Comments
TroyWorks said on Aug 26, 2004 at 8:13 PM : rghome said on Oct 31, 2004 at 2:00 PM : No screen name said on Dec 16, 2004 at 8:07 AM : No screen name said on Jan 13, 2005 at 10:51 AM : Whittaker007 said on Apr 23, 2005 at 11:51 PM : No screen name said on Jul 1, 2005 at 11:32 PM : moloko5 said on Sep 22, 2005 at 9:27 AM :