How can the callback CCCallFuncN implemented in javascript?

Hi,

I am moving a sprite using cc.MoveTo.create(); and want to remove the sprite after moving is done .

This is implemented in c++ for simple game as :

CCFiniteTimeAction* actionMove = CCMoveTo::create( (float)actualDuration,
ccp(0 - target~~>getContentSize.width/2, actualY) );
CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create);
target~~>runAction( CCSequence::create(actionMove, actionMoveDone, NULL) );

I have tried to do this as

var actionTo = cc.MoveTo.create(10,cc.p(x,0));
var actionMoveDone = cc.CallFunc.create(this,this.spriteMoveFinished);
this.ball.runAction(actionTo);

but it gives me an error , Uncaught TypeError: Object # has no method ‘call’ when the object has finally moved to destination .

Please tell me how to do it.

hello, do you use the latest version of cocos2d-html5?
if that, you should read this document: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Upgrade_Guide_for_Cocos2d-html5_v21

you should revert the order of selectorTarget and selector.

var actionTo = cc.MoveTo.create(10,cc.p(x,0));
var actionMoveDone = cc.CallFunc.create(this.spriteMoveFinished, this);
this.ball.runAction(actionTo);

Thanks boruis yan,
I am very grateful to your answer.