Flash CS3 Documentation |
|||
| Flash Lite 2.x ActionScript Language Reference > ActionScript language elements > Operators > instanceof operator | |||
object instanceof classConstructor
Tests whether object is an instance of classConstructor or a subclass of classConstructor. The instanceof operator does not convert primitive types to wrapper objects. For example, the following code returns true:
new String("Hello") instanceof String;
Whereas the following code returns false:
"Hello" instanceof String;
object : Object - An ActionScript object.
classConstructor : Function - A reference to an ActionScript constructor function, such as String or Date.
Boolean - If object is an instance of or a subclass of classConstructor, instanceof returns true, otherwise it returns false. Also, _global instanceof Object returns false.
Flash CS3