brean Posted September 28, 2015 Share Posted September 28, 2015 Hi, what is the default for creating custom events in pixi v3 (like a change-event when something in my UI changes - I am currently using callback functions but that gets kind of ugly as my projects grow bigger)?Can you show me some example code? Quote Link to comment Share on other sites More sharing options...
xerver Posted September 28, 2015 Share Posted September 28, 2015 What are you trying to accomplish? Pixi uses EventEmitter3 to make objects able to emit events, if you are trying to emit a custom even from a sprite or container something you can just do it since events are arbitrary strings: sprite.on('my-event', function (data1, data2) { console.log(data1, data2);});sprite.emit('my-event', 'somedata', 'moredata'); Quote Link to comment Share on other sites More sharing options...
brean Posted October 2, 2015 Author Share Posted October 2, 2015 Thank you, that was exactly what I was looking for.If I want to dig deeper into the code: is this the right repo for EventEmitter3?https://github.com/primus/eventemitter3 Quote Link to comment Share on other sites More sharing options...
xerver Posted October 2, 2015 Share Posted October 2, 2015 Yes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.