Class: AudioSprite

Phaser. AudioSprite

Phaser.AudioSprite

new AudioSprite(game, key)

Audio Sprites are a combination of audio files and a JSON configuration. The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite

Parameters:
Name Type Description
game Phaser.Game

Reference to the current game instance.

key string

Asset key for the sound.

Source:

Members

autoplay

Is a sound set to autoplay or not?

Properties:
Name Type Description
autoplay boolean
Default Value:
  • false
Source:

autoplayKey

If a sound is set to auto play, this holds the marker key of it.

Properties:
Name Type Description
autoplayKey string
Source:

config

JSON audio atlas object.

Properties:
Name Type Description
config object
Source:

game

A reference to the currently running Game.

Properties:
Name Type Description
game Phaser.Game
Source:

key

Asset key for the Audio Sprite.

Properties:
Name Type Description
key string
Source:

sounds

An object containing the Phaser.Sound objects for the Audio Sprite.

Properties:
Name Type Description
sounds object
Source:

Methods

get(marker) → {Phaser.Sound}

Get a sound with the given name.

Parameters:
Name Type Description
marker string

The name of sound to get.

Source:
Returns:

The sound instance.

Type
Phaser.Sound

play(marker, volume) → {Phaser.Sound}

Play a sound with the given name.

Parameters:
Name Type Argument Default Description
marker string <optional>

The name of sound to play

volume number <optional>
1

Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).

Source:
Returns:

This sound instance.

Type
Phaser.Sound

stop(marker)

Stop a sound with the given name.

Parameters:
Name Type Argument Default Description
marker string <optional>
''

The name of sound to stop. If none is given it will stop all sounds in the audio sprite.

Source:
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Oct 09 2014 16:09:47 GMT+0100 (BST) using the DocStrap template.