ActionScript: Determine wether superclass implements a particular interface?

Posted by David Wolever on Stack Overflow See other posts from Stack Overflow or by David Wolever
Published on 2010-04-08T17:06:12Z Indexed on 2010/04/08 17:13 UTC
Read the original article Hit count: 265

Filed under:

Is there any non-hacky way to determine wether a class' superclass implements a particular interface?

For example, assume I've got:

class A extends EventDispatcher implements StuffHolder {
    private var myStuff = someKindOfStuff;

    public function getStuff():Array {
        if (super is StuffHolder) // <<< this doesn't work
            return super['getStuff']().concat([myStuf]);
        return [myStuff];
}

class B extends A {
    private var myStuff = anotherKindOfStuff;
}

How could I perform that super is StuffHolder test in a way that, well, works? In this case, it always returns true.

© Stack Overflow or respective owner

Related posts about actionscript-3