Another thing I needed was a strict abstract class in AS3, again, public only constructors, and the absence of the “abstract” keyword from ActionScript meant a workaround.
public class AbstractExample
public function AbstractExample()
if( Class( getDefinitionByName( getQualifiedClassName( this ) ) ) == AbstractExample ) throw new Error( ‘AbstractExample must be extended’ );
// rest of constructor here…
I like this solution best as it doesn’t rely on strings for comparison as in Tink’s example. His method is shorter, and easier for typing. It’s down to personal preference really.