label.runAction(cc.Sequence.create(
cc.MoveTo.create(0.3, cc.p(label.x, label.y+heightunit/2)),
cc.CallFunc.create(function () {
ctx.removeChild(label);
}, this)));
为何 CallFunc 提示 undefined,是否使用CallFunc需要什么步骤?
label.runAction(cc.Sequence.create(
cc.MoveTo.create(0.3, cc.p(label.x, label.y+heightunit/2)),
cc.CallFunc.create(function () {
ctx.removeChild(label);
}, this)));
为何 CallFunc 提示 undefined,是否使用CallFunc需要什么步骤?
这涉及到js的闭包 ctx是找不到的 。不晓得你的ctx代表什么
callFunc用法参考api文档http://www.cocos2d-x.org/reference/html5-js/V3.0rc0/index.html
匿名函数有两个参数如下:
label.runAction(cc.Sequence.create(
cc.MoveTo.create(0.3, cc.p(label.x, label.y+heightunit/2)),
cc.CallFunc.create(function (actionNode,data) {
ctx.removeChild(label);
}, this)));
cc.CallFunc 是cc的吧,ctx只是一个Layer的而已,与这无关吧
如果只是callFunc提示的话确实很神奇

就这样,都提示未定义,是不是哪里我没加载?
自己解决了。moduleConfig.json 里面居然没包含 CCActionInstant.js ,添加就可以了。瞬间感觉这个提问太弱智了。