instanceof
Top  Previous  Next


SWiSH Player Support
SWF5 or later - Supported Internally

Syntax
object instanceof class

Arguments
object: A SWiSHscript object.
class: A reference to an Actionscript constructor class. Object, String, MovieClip, Date, Function, etc.

Returns
If the object is an instance of the specified class, instanceof will return true. If the object is not an instance of the specified class, instanceof will return false.

Description
Operator; Tests if an object is an instance of the specified class, returns true if it does and false if it does not.

Note: The internal SWiSH player only supports the classes Object, MovieClip, Date, and Function.

Sample

onFrame (1{
    today = new Date();
    if(today instanceof Date){
        trace("Yes it is");
    }
 else {
        trace("No it isn't");
    }

}
// The script above displays "Yes it is" in the debug window