# Sound over a bunch of scenes

**URL:** <https://forum.kirupa.com/t/sound-over-a-bunch-of-scenes/21999>\
**Category:** Uncategorized\
**Created:** [May 29, 2003, 12:37am UTC](https://forum.kirupa.com/t/sound-over-a-bunch-of-scenes/21999 "2003-05-29T00:37:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GloryBe](https://avatars.discourse-cdn.com/v4/letter/g/f6c823/32.png) [@GloryBe](https://forum.kirupa.com/u/GloryBe)\
**Post date:** [May 29, 2003, 12:37am UTC](https://forum.kirupa.com/t/sound-over-a-bunch-of-scenes/21999/1 "2003-05-29T00:37:41Z")

</div>

does anybody have problems with this?

i have a bunch of scenes in a web cartoon i’m doing and i want a constant song to go over them all without breaking, is there someway of doing this? do i have to throw every scene all into one scene? is that the only way

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2003, 2:48am UTC](https://forum.kirupa.com/t/sound-over-a-bunch-of-scenes/21999/2 "2003-05-29T02:48:07Z")

</div>

👽  
By no means. While most people seem scared of scenes (they are wierd and add extra filesize…but I like them), you merely have to do something like this:

```php

//makes the object "backgroundSong" a sound object
_root.backgroundSong = new Sound();
//attaches an mp3 in from the library with the
//linkage name of "backing" to the sound object
//"backgroundSong"
_root.backgroundSong.attachSound("backing");
//tell the sound object "backgroundSong" to start
//playing the attached mp3 at second 0 of the song
//and play the song only 1 time
_root.backgroundSong.start(0,1);
//this set of code will be executed when the song
//completes playing 
_root.backgroundSong.onSoundComplete = function() {
//When the song completes playing...
//start the song at second 0 and play
//only 1 time
_root.backgroundSong.start(0,1);
}

```

Alright, the comments should explain the code. Now, if you’ve encountered something of this sort before, you might be wondering why I didn’t write code like this…

```php

//loop the song 99 times
_root.backgroundSong.start(0,99);

```

Well, say someone sits there and listens to the song a 99 times…well…then there’s no music. So, the code I’ve written will continue to play the song because, when the song is finished playing, it starts it over. It’s like a continuous loop. Of course, this can be stopped by telling the sound object to stop (in which case the onSoundComplete code is not executed):

```php

//STOP! I'm tired of the song...
_root.backgroundSong.stop();

```

Alright, that should be it.

Later,  
–Elios

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2003, 2:52am UTC](https://forum.kirupa.com/t/sound-over-a-bunch-of-scenes/21999/3 "2003-05-29T02:52:49Z")

</div>

you the man elios

thanks
