Extending cc.Sprite

Hi,

I’d like to make a class that extends cc.Sprite. Right now, I’m trying to do it as follows:

var ExtendedSprite = cc.Sprite.extend(
{
    ctor:function () {
        this._super();
    },
});

Then I have another class, “Ball,” meant to extend ExtendedSprite:

var Ball = ExtendedSprite.extend(
{
    ctor:function() 
    {
        this.initWithSpriteFrameName("ball_1.png");
    },
});

I’m then trying to create a new instance of Ball as follows:

this._ball = new Ball();

The app always crashes on the new Ball() line without giving me any further information. If I make Ball extend cc.Sprite, it works fine, so I’m clearly doing something wrong when I try to extend it with ExtendedSprite. Does anyone have any pointers for how to do this properly? Any advice is greatly appreciated!

Maybe it will help You. Ship.js from MoonWarrior game example:

var Ship = cc.Sprite.extend({
    ctor:function () {

        // needed for JS-Bindings compatibility
        cc.associateWithNative( this, cc.Sprite );

        //init life
        var shipTexture = cc.TextureCache.getInstance().addImage(s_ship01);
        this.initWithTexture(shipTexture, cc.rect(0, 0, 60, 38));
        this.setTag(this.zOrder);
        this.setPosition(this.appearPosition);
    }
});

and next:

this._ship = new Ship();

Thanks for the response! Unfortunately, that’s not what I’m looking for; extending cc.Sprite once, like they do in that example, works fine. I’m trying to extend cc.Sprite with one class, and then extend that class.