Adding a class constructor for my class gets TypeError

I have a class Cannon, which is linked from my library…
When I don’t have the constructor in, and on the first frame of my timeline I do:

addChild(new Cannon());

It works perfectly.

But, when I add the constructor, even if there is nothing in the constructor, i get this error at compile-time:


TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Cannon$iinit()
    at cannon_fla::MainTimeline/cannon_fla::frame1()

Does anyone know whats going on?

This is my shortened code with the constructor:


package {
    public class Cannon extends MovieClip{
        ...
        public function Cannon(){
           ...
        }
        ...
    }
}