Jump to content

AudioName extends Phaser.Audio


PiraTa
 Share

Recommended Posts

module Sounds
{
    export class Timer extends Phaser.Sound
    {
        public autoplay: boolean = false;

        public constructor(game: Phaser.Game)
        {
            super(game, 'timerSound', 1);
        }
    }
}

I've sound class, which extends to Phaser.Sound

When I'm creating instance of this audio class and call play method, doesn't work.
 

var timerOudio: Phaser.Sound = new Sounds.Timer(game);
timerOudio.play();


and this code bellow works fine:
 

var timerAudio: Phaser.Sound = game.add.audio('timerSound');
timerAudio.play();


In case, when I'm creating sprite and extending it to Phaser.Sprite, I'm adding in constructor: 

game.add.existing(this);

But this doesn't work for audio.

What I'm doing wrong with audio?

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...