Hello, im trying to do a custom window, but when i try to put the script to close the window when pressed "Cancel" button the game got a typeError saying the "this._brandnewwindow.setHandler is not a function". What i should do?
JavaScript:
function Scene_Testing() {
this.initialize.apply(this, arguments);
}
Scene_Testing.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Testing.prototype.constructor = Scene_Testing;
Scene_Testing.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Testing.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this._brandnewwindow = new Window_Testing(0, 0, 320, 240);
this._brandnewwindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._brandnewwindow);
};
function Window_Testing () {
this.initialize.apply(this, arguments);
}
Window_Testing.prototype = Object.create(Window_Base.prototype);
Window_Testing.prototype.constructor = Window_Testing;
Window_Testing.prototype.initialize = function (x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
}