I'm trying to create a base class that has createjs EventDispatcher functionality and then create sub classes from this base class but if I then try to use addEventListener on the subclass instance I get the error:
TypeError: _subClass.addEventListener is not a function
The constructors of my classes look like this:
var BaseClass = function(id)
{
_instance = this;
_id = id;
createjs.EventDispatcher.initialize(BaseClass.prototype);
};
var SubClass = function(id)
{
BaseClass.call(this, id);
SubClass.prototype = Object.create(BaseClass.prototype);
_instance = this;
};
How can I make it work so that SubClass inherits the applied CreateJS event dispatcher functionality from BaseClass? So far it only works if I also apply the event dispatcher in the sub class constructor but that somehow defies the whole purpose of inheritance:
createjs.EventDispatcher.initialize(SubClass.prototype);