You may also use the sprite itself as the target object, so in the called function “this” will already be mysprite. Especially useful if you used a local variable for the sprite, like:
cc.callFunc(mysprite.removeFromParent, mysprite)
And sometimes you may also want to pass another parameter to the function:
cc.callFunc(this.done, this, param)
Just note that in this case you will get two paramters passed to the function “this” and “param”, so your function must take both like:
thanks for the reply… i tried doing your example but it is showing errors…
error: wrong number of arguments: 2, was expecting 1
i need to make the function call after the movement…is there any way to do this??
can this method used to call a function after completing a function… like for example…
var action=cc.moveBy(2,cc.p(100, 200));
var callfunc=cc.callFunc(this.move,this);
var callfuncro=cc.callFunc(this.rotate,this);
this.sprite.runAction(cc.sequence(action,callfunc,callfuncro));
i have tried using delay before and worked,i just wanted to know if there exist any other method rather than delay to make a function call after finishing a primary function… anyway thanks for the reply…