Adding new Event Listener (SOLVED)

Hi all,

im trying to figure out how to add a new Event Listener for the Right Key on the keyboard.
Like the ones for "keyup" and "keydown".

Code:
Input._setupEventHandlers = function() {
    document.addEventListener('keydown', this._onKeyDown.bind(this));
    document.addEventListener('keyup', this._onKeyUp.bind(this));
    window.addEventListener('blur', this._onLostFocus.bind(this));
    document.addEventListener('keyright', this._onKeyRight.bind(this));
};

Input._onKeyRight = function(event) {
    if (this._shouldPreventDefault(event.keyCode)) {
        event.preventDefault();
    }
    if (event.keyCode === 39) {    // Numlock
        this.clear();
    }
    var buttonName = this.keyMapper[event.keyCode];
    if (ResourceHandler.exists() && buttonName === 'keyright') {
        ResourceHandler.retry();
    } else if (buttonName) {
        this._currentState[buttonName] = true;
    }
};

//---

Scene_BattleFront.prototype.createSkillWindow = function() {
    this._skillWindow = new Window_SkillList(350, 350, 500, 500);
    this._skillWindow.setHelpWindow(this._helpWindow);
    this._skillWindow.setHandler('ok',     this.onSkillOk.bind(this));
    this._skillWindow.setHandler('cancel', this.onSkillCancel.bind(this));
    this._skillWindow.setHandler('keyright',     this.onKeyRightt.bind(this));
    this._skillTypeWindow.setSkillWindow(this._skillWindow);
    this.addWindow(this._skillWindow);
};

Scene_BattleFront.prototype.onKeyRightt = function() {
    console.log("got it")
};

It doesnt work however. Since the cursor is in the Window_SkillList my goal is that the user can press to right arrow key to change to another window.
Das funktioniert so leider nicht. Die .setHandler() Funktion bezieht sich immer auf ein Command Window in der Scene und nicht auf Event Listener des documents.
Ich würde einen etwas anderen Weg vorschlagen als Lösung für dein Vorhaben. Du kannst einfach in der Update Methode der jeweiligen Scene abfragen, ob eine bestimmte Taste gedrückt wurde.

PHP:
var _Scene_BattleFront_update = Scene_BattleFront.prototype.update;
Scene_BattleFront.prototype.update = function () {
   _Scene_BattleFront_update.call(this);
   if (Input.isTriggered('right')) {
       // Do stuff
       SoundManager.playCursor();
   }
};
It works perfect. Thank you.
@waynee95 Please use English only. These are the official English language forums and while OP may have been able to understand German, but someone else with a similar problem and trying to find a solution may not be able to.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/adding-new-event-listener-solved.83828/