BdR Posted June 14, 2018 Share Posted June 14, 2018 I'm trying to run one of the Phaser examples in a sandbox to reproduce an audio question by running an altered version of this audio example in the sandbox. I've altered the code (see link to sandbox below) but when I click the Play tab, the console shows this error message. Quote Uncaught DOMException: Failed to execute 'postMessage' on 'Window': TypeError: Cannot set property 'prototype' of undefined could not be cloned. So it seems the sandbox cannot run Phaser games that make use of the StateManager. Should the sandbox be used in another way for the game.State to work? Am I doing something wrong here? See saved sandbox -> https://phaser.io/sandbox/edit/ZBBLlXiA Link to comment Share on other sites More sharing options...
onlycape Posted June 14, 2018 Share Posted June 14, 2018 Hi @BdR, That DOMException is resolved with this (mygame.MyGameState was undefined): mygame.MyGameState = function(game){}; mygame.MyGameState.prototype = { preload: function() { ............... more code ............... Phase Sandbox can use the StateManager. Here a simple example: http://phaser.io/sandbox/UUWjHaIA Each state must contain at least a one of the required functions: preload, create, update or render (check your "mygame.MyState ") To change the game size use the size selector in the "Play" tab. Declaring a new Phaser.game adds other canvas, and seems game.destroy() can't be used. Regards. BdR 1 Link to comment Share on other sites More sharing options...
BdR Posted June 15, 2018 Author Share Posted June 15, 2018 9 hours ago, onlycape said: Phase Sandbox can use the StateManager. Here a simple example: http://phaser.io/sandbox/UUWjHaIA @onlycape Thanks I got it to work by looking at that example -> http://phaser.io/sandbox/lARYwwpN Link to comment Share on other sites More sharing options...
Recommended Posts