In AS3, I'm trying to check whether an object is an instance of, or extends a particular class. Using something like if (object is ClassName)
works fine if the object is an instance of ClassName
but not if it's an instance of a class that extends ClassName
.
Pseudo-code example:
class Foo {}
class Bar extends Foo {}
var object = new Bar();
if (object is Foo){ /* not executed */ }
if (object is Foo){ /* is executed */ }
I want something like:
class Foo {}
class Bar extends Foo {}
var object = new Bar();
if (object is Foo){ /* is executed */ }
Any ideas anyone?