describeType() , . , Class.prototype prototype.isPrototypeOf(). , , , ( , ).
( ), , flash.utils.getDefinitionByName(), , - . SWF, - ApplicationDomain.currentDomain.getDefinitionByName() contextLoader.currentDomain.getDefinitionByName().
, String , . , false, , , .
public static function inheritsFrom(childClass:*, parentClass:*, mustBeChild:Boolean = false) {
var child:Class,
parent:Class;
if (childClass is Class) {
child = childClass;
} else if (childClass is String){
child = getDefinitionByName(childClass) as Class;
}
if (! child) {
throw new ArgumentError("childClass must be a valid class name or a Class");
}
if (parentClass is Class) {
parent = parentClass;
} else if (parentClass is String){
parent = getDefinitionByName(parentClass) as Class;
}
if (! parent) {
throw new ArgumentError("parentClass must be a valid class name or a Class");
}
if (parent.prototype.isPrototypeOf(child.prototype)) {
return true;
} else {
if (mustBeChild) {
return false;
} else {
if (parent.prototype === child.prototype) {
return true;
}
}
}
return false;
}