Jump to content

When the sound object gets created?


spinnerbox
 Share

Recommended Posts

I create new game object with

var game = new Phaser.Game(STAGE_WIDTH, STAGE_HEIGHT, phaser.AUTO, HTML_CONTAINER);

and right after this line I call to set game.sound.mute = true/false depending on the saved value in window.localStorage.

But the problem is, when I console.dir(game), it prints the structure of the Phaser game object but game.sound is still null, so I cannot set the sound to muted or unmuted at that moment.

When does game.sound sub-object gets created?

Link to comment
Share on other sites

Something sounds weird here, because if you tried to set the 'mute' property on 'game.sound' when 'game.sound' is null, you'd see an error in the JavaScript console complaining about trying to do something with a null value.

You should make sure that code is actually executing, and then if it's not, find the right place to put it. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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