I globally defined in a Layer class a Javascript array which is supposed to contain an array of sprites (CC.Sprites) object.
I fill the array with the sprites simply this way:
arrSprites : []
,
contructor: function() {
...
this.arrSprites = new Array();
this.arrSprites.push(new cc.Sprite.create(texturefile));
...
}
As I try to access in any method, not only the onTouchesMoved but in any other method with this statement an alement of the array I get the “Invalid Native object” error.
I access the spritearray this way:
mymethod: function() {
this.arrSprites[0].setTag(10); // Error here: Invalid native object.
}
What I’m doing wrong. How can I fix this ?