Event in Spine example

Hi everyone, I’m trying to make a shooting animation using Spine.
The animation has multiple parts, I want to release the bullet at the right time somewhere in one of the parts. I think event in Spine is suitable for this, but I couldn’t find example on how to do this…
My code:

this.mySpine = this.scene.add.spine(0, 0, ‘mySpine’, ‘attack’, true);
this.add(this.mySpine);

I found guide on Spine website, but it’s not javascript, and I have no idea how to code it in javascript with my limited knowledge…

Do you have any suggestion? Your help is much appreciated. :innocent:

I think it has something to do with these Phaser 3 API Documentation - Namespace: SpinePluginEvents

I tried this and it works for the animation-complete event.

this.mySpine.on(‘complete’, this.actionComplete, this);

But this doesn’t work for the custom event which I want to achieve:

this.mySpine.on(‘event’, this.actionEvent, this);

It looks like Spine integration is still young with Phaser, or maybe I’m not good enough to make it work the way I want.
I think I give it up here…

It works for me:

    create () {
      spineObj = this.add.spine(41, 650, 'bull', 'attack', true)
      spineObj.on('event', (ft: SpineEventFt, de: SpineEventDe) => {
        console.log(ft, de, de.data.name)
      }, this)
    }
		this.spine.animationState.addListener({
			event: (trackEntry: TrackEntry, event: any) => {
				console.log("Event fired", event.data.name);
			}
		});