js4fun Posted April 5, 2014 Share Posted April 5, 2014 Hi all, I am using Phaser to develop a game in a site which power by angularJS. Now I have two pages, home page and the Phaser game page. When I link to the game page from home page, then link back to home page, and then link to game page again, I get errors below: WebGL: INVALID_OPERATION: uniform2f: location not for current program WebGL: INVALID_OPERATION: bindTexture: object not from this context As is known to all, angularJS site is Single Page Application, which means that there is only one web page, and when I link to the game page then link to other page, the Phaser instance may not be destoryed. For example, when I use CKEditor in angularJS, I always use code below to avoid this issue: var editor = CKEDITOR.instances[name]; if (editor) { editor.destroy(true) } //create a new instance... Is there method(s) like destroy() or kill() in Phaser to terminal a instance? Link to comment Share on other sites More sharing options...
bmceldowney Posted April 6, 2014 Share Posted April 6, 2014 Looks like the Game class has a .destroy() method. http://docs.phaser.io/Phaser.Game.html#destroy You could handle the '$destroy' event on your $scope and call it there. Link to comment Share on other sites More sharing options...
Recommended Posts