audio.play

play(sound_name: string, loop: boolean, onend: Function, volume: number) → {number}

play the specified sound

// play the "cling" audio clip
me.audio.play("cling");
// play & repeat the "engine" audio clip
me.audio.play("engine", true);
// play the "gameover_sfx" audio clip and call myFunc when finished
me.audio.play("gameover_sfx", false, myFunc);
// play the "gameover_sfx" audio clip with a lower volume level
me.audio.play("gameover_sfx", false, null, 0.5);
Parameters:
Name Type Attributes Default Description
sound_name string

audio clip name - case sensitive

loop boolean

<optional>

false

loop audio

onend Function

<optional>

Function to call when sound instance ends playing.

volume number

<optional>

default

Float specifying volume (0.0 - 1.0 values accepted).

Returns:
Type Description
number

the sound instance ID.

Powered by webdoc!