pixijs / animate

PixiJS runtime library for content from Adobe Animate CC
https://pixijs.io/animate/
MIT License
215 stars 33 forks source link

Dispatching Events from MovieClips #60

Closed kburke3 closed 6 years ago

kburke3 commented 6 years ago

Hello, Is it possible to dispatch Pixi Animate events from the Adobe Animate timeline? If so, how would I listen for them?

Thank you!

bigtimebuddy commented 6 years ago

You can add a frame script inside of animate, for instance:

this.emit('someEvent');

Then you can listen to the instance of your stage:

var scene = new PIXI.animate.Scene(300, 480, {
    view: document.getElementById("stage"),
    backgroundColor: 0xffffff,
    antialias: true
});
scene.load(lib.MyStage, function(instance) {
    instance.on('someEvent', function() {
        console.log('event handled');
    });
});
kburke3 commented 6 years ago

Excellent, thank you!!!!