setMovementEventCallFunc 如何取消

setMovementEventCallFunc挂了监听如何取消?
试了setMovementEventCallFunc(nil)不行

3.0 lua代码测试

local function attackerAnimationEvent(armature,movementType,movementID)
local id = movementID
if movementType == ccs.MovementEventType.loopComplete then
if id == “attack” then
armature:stopAllActions()
armature:getAnimation():play(“idel”)
elseif id == “idel” then
armature:getAnimation():setMovementEventCallFunc(nil)
end
end
end

attackerArmature:getAnimation():setMovementEventCallFunc(attackerAnimationEvent)

设置为null即可清除事件监听。

lua里面设置为空会报错…

大家自行修改一下
lua_cocos2dx_ArmatureAnimation_setMovementEventCallFunc 这个函数
if (1 == argc)
{
if (!toluafix_isfunction(L,2,“LUA_FUNCTION”,0,&tolua_err))
{
self->setMovementEventCallFunc(nullptr);
return 0;
}
。。。。
如果传参不是function 用nullptr 将event监听移除

cocos2d的员工们 还是要认真工作啊

你好,我在源码里怎么没有找到这个函数呢,我也遇到了lua里无法取消setMovementEventCallFunc 时间的问题,请问是要修改cocos2dx的源码吗?

setMovementEventCallFunc(function() end)
setMovementEventCallFunc(assert)

版主 我的设置这个回调时,在Android上没问题,但是win32 运行就出错
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
这是什么原因呢?

你们是用什么开发的,quick-coco2dx ?