我想添加彈出到遊戲。我使用相位器,發現modal.js添加相位器彈出它似乎是有用的,但是當我試圖添加這個我得到一個錯誤「未捕獲TypeError:不能設置屬性'modal1'未定義」。我想我只是因爲我的編碼結構而得到這個錯誤。這裏是我的代碼向相位遊戲添加彈出
var reg={};
createModals: function(){
reg.modal.createModal({
type: "modal1",
includeBackground: true,
modalCloseOnInput: true,
itemsArr: [{
type: "graphics",
graphicColor: "0xffffff",
graphicWidth: 300,
graphicHeight: 300,
graphicRadius: 40
}, {
type: "text",
content: "The white behind me\nis a [Phaser.Graphic]",
fontFamily: "Luckiest Guy",
fontSize: 22,
color: "0x1e1e1e",
offsetY: -50
}, ]
});
},
showModal1: function(){
reg.modal.showModal("modal1");
}
可以與任何幫助......
我得到一個錯誤「遺漏的類型錯誤: 在patternsRatio.game1.create(game1.js:97) 在Phaser.StateManager:在新gameModal(8 modal.js)無法設置屬性 '模態' 的不確定 在Phaser.Loader.finishedLoading(phaser.js:74233)上的.loadComplete(phaser.js:30083) (在Phaser.Loader.processLoadQueue(phaser.js:74190) 的Phaser.Loader.asyncComplete(phaser.js:74263)上的 ) at Phaser.Loader.fileComplete(phaser.js:75120) at HTMLImageElement.file.data.onload(phaser.js:74522)「 –