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

 Share

  • Recently Browsing   0 members

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