mobile - Corona: Error on removing event listeners from runtime during destroy -
i cleaning scene in corona , attempting remove event listeners in destroy event scene. i've added events in show event scene, follows:
function scene:show(event) runtime:addeventlistener("enterframe", onframe) runtime:addeventlistener("touch", ontap) runtime:addeventlistener("collision", oncollision) end function scene:destroy(event) runtime.removeeventlistener("enterframe", onframe) runtime.removeeventlistener("touch", ontap) runtime:removeeventlistener("collision", oncollision) end
i'm getting null pointer in destroy event:
?:0: attempt index field '_super' (a nil value) stack traceback: ?: in function 'removeeventlistener'
what "_super" trying access, , why nil? i've checked , of functions listed above (onframe, ontap, , oncollision) not nil. if has idea what's going on here, please let me know!
seems you've mistyped when calling removeeventlistener.
see:
runtime . removeeventlistener() vs
runtime : removeeventlistener()
when call removeeventlistener '.' (dot), runtime reference isn't passed implicitly first argument removeeventlistener().
Comments
Post a Comment