Get ActionScript Classes that Implement an Interfa

2019-06-01 03:27发布

问题:

In ActionScript (AS3) how do I find all the classes that implement a particular interface?

回答1:

In OOP terms, you never want to be able to do this: the primary characteristic of interfaces is they are terms of a contract. Any class can choose to fulfill that contract and be able to say "I implement this interface".

Any code that references an instance of the interface don't care what class actually implements it: they don't have to; that's the really cool part of interfaces.

But if you want to find out, grep for "implements IFred"

Cheers



回答2:

I've figured out how to do this and posted a demo on my blog. It uses the getDefinitionNames library mentioned in the comments above.



回答3:

In Flash Builder I use ctrl-h and search for method names or the actual name of the interface.