# Spine Events - Unexpected Behavior

**URL:** <https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000>\
**Category:** Spine\
**Created:** [June 26, 2016, 4:29am UTC](https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000 "2016-06-26T04:29:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kilopop](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/k/a88e4f/32.png) [@kilopop](https://forums.solar2d.com/u/kilopop)\
**Post date:** [June 26, 2016, 4:29am UTC](https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000/1 "2016-06-26T04:29:30Z")

</div>

Anyone using events in Spine effectively?

We’ve noticed some odd results using the examples provided e.g. spineboy.

The following is happening which is unexpected:

- The first time animation is set does not trigger onStart but subsequent animation setting does.
- If loop is true, onComplete fires at the start of an animation.

Using Build 2016.2883 for Windows.

To drill down to specifics, here is some of the code with comments:

```
-- Events state.onStart = function (trackIndex) print(trackIndex.." start: "..state:getCurrent(trackIndex).animation.name) end state.onComplete = function (trackIndex, loopCount) print(trackIndex.." complete: "..state:getCurrent(trackIndex).animation.name..", "..loopCount) end -- Animation calls state:setAnimationByName(0, "walk", true) -- onStart does NOT print -- onComplete prints immediately when onStart is expected with: 0 complete: walk, 0 -- onComplete fires as expected at the end of each loop state:addAnimationByName(0, "jump", false, 3) -- onStart does print for jump: 0 start: jump -- onComplete does NOT print but would have expected it to. state:addAnimationByName(0, "run", true, 0) -- onStart does print for run: 0 start: run -- onComplete prints immediately after onStart with: 0 complete: run, 0 -- onComplete fires as expected at the end of each loop.
```

---

<div class="post-metadata">

**Author:** ![Reaver](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/r/90ced4/32.png) [@Reaver](https://forums.solar2d.com/u/Reaver)\
**Post date:** [June 28, 2016, 2:59pm UTC](https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000/2 "2016-06-28T14:59:25Z")

</div>

Hi,

How recently have you updated the spine runtime? There was recently an update with bugfixes for the lua runtime. I’m not sure there was anything for events specifically but it might be worth a shot.

---

<div class="post-metadata">

**Author:** ![kilopop](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/k/a88e4f/32.png) [@kilopop](https://forums.solar2d.com/u/kilopop)\
**Post date:** [June 28, 2016, 8:00pm UTC](https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000/3 "2016-06-28T20:00:02Z")

</div>

Hi Reaver, thanks for your reply. I asked the same question over at [esoteric.com](http://esoteric.com). Turns out it relates to known issues with state events. Read more here: [http://esotericsoftware.com/forum/events-onStart-and-onComplete-bugs-6593](http://esotericsoftware.com/forum/events-onStart-and-onComplete-bugs-6593)

---

<div class="post-metadata">

**Author:** ![Reaver](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/r/90ced4/32.png) [@Reaver](https://forums.solar2d.com/u/Reaver)\
**Post date:** [June 28, 2016, 2:59pm UTC](https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000/4 "2016-06-28T14:59:25Z")

</div>

Hi,

How recently have you updated the spine runtime? There was recently an update with bugfixes for the lua runtime. I’m not sure there was anything for events specifically but it might be worth a shot.

---

<div class="post-metadata">

**Author:** ![kilopop](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/k/a88e4f/32.png) [@kilopop](https://forums.solar2d.com/u/kilopop)\
**Post date:** [June 28, 2016, 8:00pm UTC](https://forums.solar2d.com/t/spine-events-unexpected-behavior/340000/5 "2016-06-28T20:00:02Z")

</div>

Hi Reaver, thanks for your reply. I asked the same question over at [esoteric.com](http://esoteric.com). Turns out it relates to known issues with state events. Read more here: [http://esotericsoftware.com/forum/events-onStart-and-onComplete-bugs-6593](http://esotericsoftware.com/forum/events-onStart-and-onComplete-bugs-6593)
