Legacy:Sound/stop

From Spherical
Jump to: navigation, search

Play a loaded sound.

Usage

sound.stop();


  • sound Sphere Sound object. The sound to stop.

Examples

Stopping and playing sound with the enter key:

var my_music = LoadSound("your_sound.ogg");
var toggle = false;

my_music.play(true);

while (!IsKeyPressed(KEY_ESCAPE))
{
    while (AreKeysLeft()) {
        if (GetKey() == KEY_ENTER) toggle ? my_music.play() : my_music.stop();
    }
}

Notice the above is different from pause which will continue where you left off.

See also


API:Sound/navbox