bbyford Posted April 23, 2020 Share Posted April 23, 2020 How do I dispatch an event on an object?? For example if you have an interactive sprite with an on pointerdown event listener start_button.on('pointerdown', handleClick); how can you trigger from javascript??? Couldn't find anything useful in the docs for the events manager. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 23, 2020 Share Posted April 23, 2020 That's because its EventEmitter3 and not something homebrewn https://github.com/primus/eventemitter3 element.emit('pointerdown', yourAwesomeParamsIDon'tKnowAboutTotallyBecauseYouNeedInteractionData); maybe one of params is "element" itself. Quote Link to comment Share on other sites More sharing options...
bbyford Posted April 23, 2020 Author Share Posted April 23, 2020 Thanks @ivan.popelyshev simply el.emit('pointerdown'); did the trick ? 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.