Like Java, AS3 has a super() function you can call from your constructor to call your parent class’ constructor. As it turns out, this is more optional than you might think.

The super() function works like this:

class Parent
{
	public function Parent(val:int=0)
	{
		trace("Parent constructor got: " + val);
	}
}
class Child extends Parent
{
	public function Child()
	{
		super(33);
		trace("Child constructor");
	}
}

This prints:

Parent constructor got: 33
Child constructor

Unlike C++ or Java, you can move the super() call past the beginning of your constructor:

public function Child()
{
	trace("Child constructor");
	super(33);
}

And you will predictably get:

Child constructor
Parent constructor got: 33

You may also omit the super() call altogether if your parent class’ constructor requires no arguments:

public function Child()
{
	trace("Child constructor");
}

In this case your super() call is implicitly placed at the beginning of your constructor so it as if you typed:

public function Child()
{
	super();
	trace("Child constructor");
}

Knowing that, you again get a predictable result:

Parent constructor got: 0
Child constructor

My latest discovery is that you can actually not call your super class’ constructor at all! Check this out:

public function Child()
{
	if (false)
	{
		super();
	}
	trace("Child constructor");
}

Since you have a super() call in your function, the compiler will not generate the default super() call at the start of your constructor. You then place the super() call within an impossible-to-reach conditional and it will never be called. The result compiles without warning or error and runs perfectly. It prints this:

Child constructor

Since constructors are a good place to put initialization code, beware that you’re skipping all of what is assumed to have been necessary to instantiate the class. This may be dangerous, so use it only when you’re really sure that the constructor is not relied on.