- Joined
- Jan 10, 2017
- Messages
- 348
- Reaction score
- 473
- First Language
- Italian
- Primarily Uses
- RMMZ
Hello guys, I want to discuss with you today about a problem that I noticed in all the version of pixi.js that are inserted in Rpg Maker MV.
Maybe I make something wrong, but I can't find any way to make it works.
My problem is related to bound a mouse event to a Sprite (or PIXI.Sprite) or another PIXI object (like Graphics, container etc...).
For example:
This is a pretty basic code and as you can see I have bound to "mousedown" event an anonymous function that should pop-up a log inside the console.
However, this event (or all the other in all the forms: "pointerdown" etc...) does not seem to work or trigger anything, but checking the object properties inside console it looks like the events are bound to the related callback.
I have tried to:
• Make the container (Scene) interactive, too.
• Tried to change the prevent event default inside the Graphics._renderer;
• Try to bind the callback directly to a function
Ex sprite.mousedown = function() { console.log('myEvent') }
So, Am I missing something? Have you my same problem or It should be coded in a different way?
Thank you in advance for the help!
Maybe I make something wrong, but I can't find any way to make it works.
My problem is related to bound a mouse event to a Sprite (or PIXI.Sprite) or another PIXI object (like Graphics, container etc...).
For example:
Code:
var sprite = new Sprite() (or new PIXI.Sprite() )
sprite.texture = PIXI.loader.resources['myResource'].texture
sprite.position.set(0,0)
sprite.interactive = true //This is needed for make the mouse events works;
sprite.on('mousedown', function() {console.log('myEvent') })
this.addChild(sprite)
However, this event (or all the other in all the forms: "pointerdown" etc...) does not seem to work or trigger anything, but checking the object properties inside console it looks like the events are bound to the related callback.
I have tried to:
• Make the container (Scene) interactive, too.
• Tried to change the prevent event default inside the Graphics._renderer;
• Try to bind the callback directly to a function
Ex sprite.mousedown = function() { console.log('myEvent') }
So, Am I missing something? Have you my same problem or It should be coded in a different way?
Thank you in advance for the help!


