Sign in to follow this  

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"TheGame");

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");





Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.