I created a class by extending PhysicsSprite like below.
var AsteroidSprite = cc.PhysicsSprite.extend
({
.....
.....
.....
});
I create a lot of these AsteroidSprites in my GamePlayScene and store them in an array. Then on a specific event I iterate over the array and call pause() on all of the AsteroidSprites like below.
for (var i = 0, l = this._arrayAsteroids.length; i < l; i++)
{
var asteroidSprite = this._arrayAsteroids[i];
asteroidSprite.pause();
}
This causes error with the following log.
jsb: ERROR: File /Projects/Cocos2D/AsteroidsChallenge/frameworks/cocos2d-x/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp: Line: 2481, Function: js_cocos2dx_CCNode_pause
js_cocos2dx_Node_pause : Invalid Native Object
jsb: ERROR: File /Projects/Cocos2D/AsteroidsChallenge/frameworks/cocos2d-x/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp: Line: 922, Function: myCollisionBegin
Error calling collision callback: begin
JS: /Users/Ehtesham/Library/Developer/CoreSimulator/Devices/3A051EAD-29C6-4453-BEAC-799861BE70D8/data/Containers/Bundle/Application/5D464CE4-7C3F-4474-A4FF-B4698A5976D8/AsteroidsChallenge-mobile.app/src/scenes/GamePlayScene.js:650:Error: js_cocos2dx_Node_pause : Invalid Native Object
To detect the problem I included the following function in AsteroidSprite.
pause: function()
{
cc.log("pause");
this._super();
}
The cc.log() function works correctly while this._super() fails.
Please help. I wasted a day on this problem.