[Resolved] how to pass the parameter to my callFunction

[Resolved] how to pass the parameter to my callFunction
0.0 0


The situation is like this I define a sprite and a sequence
Then I runAction sequence .

The code is like this:
var sprite=cc.Sprite.create(source);
var action=cc.MoveTo.create(1, (200,200));
var call_back = cc.CallFunc.create(this.callBack,this);
var sequence = cc.Sequence.create(action, call_back);

I want to Pass a parameter to my callBack function,and print this parameter
but if I write it like this:
var call_back = cc.CallFunc.create(this.callBack,this,parameter );
it doesn’t work…….


Hi, your function should take 2 parameters, target and data
where data is what you looking for,

var callback = function(target, data){
var callfunc = cc.CallFunc.create(callback, this, 123);

alternatively, you could do
var callfunc = cc.CallFunc.create(function(){
}, this)

but the first method is recommended


thank you