skeleton:setListener()¶
Type:
functionSee also: skeleton, spineEvent
Overview¶
Sets or clears the animation listener for this skeleton, the one passed to spine.create().
It only swaps that one function. "spine" listeners added with skeleton:addEventListener and
trackEntry.onComplete functions keep receiving events. Calling it inside a listener takes effect from the next
event.
Syntax¶
skeleton:setListener(listenerOrNil)
Parameters¶
listenerOrNil(required):functionornil– Function to receive events, ornilto clear listener.
Example¶
spineboy:setListener(function(event)
if event.phase == "completed" then
print("Completed:", event.animation)
end
end)
-- Later, remove listener:
spineboy:setListener(nil)