- Joined
- Sep 16, 2012
- Messages
- 453
- Reaction score
- 211
- First Language
- English
- Primarily Uses
- RMMV
So in one of the plugins I am making I am adding a command window to the map scene. I want it to be inactive until the mouse hovers over and then become inactive again when the mouse leaves. I had this working in version 4.0.0 of PIXI:
As of v4.4.1 the above method simply does nothing.
Now I have looked at the new demos for PIXI interactivity, which uses the on (or addListener) function and events like in socket.io. However I have been unsuccessful in getting it to register that the mouse is hovering/leaving the command rect. One of the things I have tried is:
Now it won't run the event upon mouse over; however I do know the event has been added by calling:
SceneManager._scene._commandWindow._events.mouseover.fn().
So my question is what do I need to change in order for it to work the way how I had it working? Is there a way I could possibly use document.addEventListener instead?
Code:
//when mouse goes over command rect this is called by pixi
myWindow_Command.prototype.mouseover = function () {
this.opacity = 255;
this.activate();
};
//when mouse leaves command rect this gets called by pixi
myWindow_Command.prototype.mouseout = function () {
this.opacity = 128;
this.deactivate();
};
//how it gets added to the map
Scene_Map.prototype.createCommandWindow = function () {
this._commandWindow = new myWindow_Command(0, 0);
this.addChild(this._commandWindow);
this._commandWindow.interactive = true;
this._commandWindow.deactivate();
}
Now I have looked at the new demos for PIXI interactivity, which uses the on (or addListener) function and events like in socket.io. However I have been unsuccessful in getting it to register that the mouse is hovering/leaving the command rect. One of the things I have tried is:
Code:
Scene_Map.prototype.createCommandWindow = function () {
this._commandWindow = new myWindow_Command(0, 0);
this.addChild(this._commandWindow);
this._commandWindow.interactive = true;
var self = this._commandWindow;
this._commandWindow.on('mouseover', function() {
self.opacity = 255;
self.activate();
});
this._commandWindow.deactivate();
}
SceneManager._scene._commandWindow._events.mouseover.fn().
So my question is what do I need to change in order for it to work the way how I had it working? Is there a way I could possibly use document.addEventListener instead?

