Jump to content

Call functon in Game state from the DOM


Recommended Posts

I need to call to call a function in my game state from the Dom to toggle the audio of my game.  Is this possible?


In index.html the game is set up like this:

//////// index.html /////////////////////////////////////////////////////////////////////////

var game;
            (function() {
                game = new Phaser.Game(640, 1195, Phaser.CANVAS, 'the-game');





After preload


is called to load the game.  The function I need to call from a button in the DOM is funcFromDom


var theGame = function(game){

theGame.prototype = {
      create: function(){


 funcFromDom: function(){
          console.log("called from the dom");





Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...