# Sound looping problems

**URL:** <https://forum.kirupa.com/t/sound-looping-problems/16274>\
**Category:** flash\
**Created:** [March 23, 2003, 12:24am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274 "2003-03-23T00:24:25Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Troll\_axethrowe](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@Troll\_axethrowe](https://forum.kirupa.com/u/Troll_axethrowe)\
**Post date:** [March 23, 2003, 12:24am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/1 "2003-03-23T00:24:25Z")

</div>

I got a sound to work in my actionscript for a flash movie. But when i put the loop in that frame it doesnt work, where do i want to put the onSoundComplete loop in the flash?

And I want to know if there is a way to make the onSoundComplete loop only loop 1 sound, rather then looping all the sounds in the scene.

---

<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:** [March 23, 2003, 12:49am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/2 "2003-03-23T00:49:17Z")

</div>

```php
mySound = new Sound();
mySound.loadSound("music.mp3",true);
kirupaSound.start(0, 99);
}

```

that shud do it whack that on like onclick or onload etc wherever u want it

thats dynamic loaded btw  
-Tom

---

<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:** [March 23, 2003, 1:00am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/3 "2003-03-23T01:00:13Z")

</div>

nope, that doesnt work because i want the sound to be an infinite loop. if the sound is like 2 seconds long i wanna have it looping on an infinit track, I cant figure out how to do this because if i put the onSoundComplete loop thing in the frame where i put the sound it doesnt work.

I want the sound to continue looping throught the whole movie, not just at the end frame, how do i do this for a short sound?

there is no tutorial on how to do this anywhere on kirupa, so i cant figure it out.

is there a symbol for infinit that i can put into the (0,99) thing to replace 99 with infinit?

---

<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:** [March 23, 2003, 1:03am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/4 "2003-03-23T01:03:05Z")

</div>

the 99 doesnt mean it only places 99 it is infinate and loops generally sound like they are infinate anyway u shudnt be able to tell it apart

---

<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:** [March 23, 2003, 1:13am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/5 "2003-03-23T01:13:52Z")

</div>

> _Originally posted by Troll\_axethrowe_  
> **I got a sound to work in my actionscript for a flash movie. But when i put the loop in that frame it doesnt work, where do i want to put the onSoundComplete loop in the flash?**

attach sound from library.

```auto
// sound object
mySound = new Sound();
// attach sound from library
mySound.attachSound("mySound");
// start sound
mySound.start();
// onSoundComplete start again
mySound.onSoundComplete = function() {
	this.start();
}

```

load sound dynamically. no stream.

```auto
// sound object
mySound = new Sound();
// load sound
mySound.loadSound("mySound");
// start sound onLoad
mySound.onLoad = function() {
	this.start();
}
// onSoundComplete start again
mySound.onSoundComplete = function() {
	this.start();
}

```

load sound dynamically. stream.

```auto
// sound object
mySound = new Sound();
// load sound
mySound.loadSound("mySound.mp3", true);
// onSoundComplete load sound again
mySound.onSoundComplete = function() {
	this.loadSound("mySound.mp3", true);
}

```

😉 =)

---

<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:** [March 23, 2003, 1:47am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/6 "2003-03-23T01:47:08Z")

</div>

{  
Mysound = new Sound(this);  
Mysound.attachSound(“coolsound”);  
Mysound.start();  
Mysound.onSoundComplete=function(){  
this.start();  
}

That is what i have in my actionscript on frame 10, it doesnt work, when it gets to frame 10 nothing starts playing. Why?

---

<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:** [March 23, 2003, 1:55am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/7 "2003-03-23T01:55:23Z")

</div>

any reason for this **{** in the first line ? 😉

and please use **actionscript** formatting tags [as] and [/as] :sleep:

---

<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:** [March 23, 2003, 1:59am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/8 "2003-03-23T01:59:29Z")

</div>

oh! and another thing that usually happens… make sure you have the id name in the linkage properties of the sound 😉 =)

---

<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:** [March 23, 2003, 2:30am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/9 "2003-03-23T02:30:11Z")

</div>

THANKS!!! it WAS that \*\*\*\* first { now she works HORRAY!!!

---

<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:** [March 23, 2003, 2:49am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/10 "2003-03-23T02:49:45Z")

</div>

no problem man 😉 =)

---

<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:** [March 23, 2003, 2:55am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/11 "2003-03-23T02:55:20Z")

</div>

on a side note, do u need the ;'s in the actionscript at all? because without them there is no difference i find.

---

<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:** [March 23, 2003, 3:09am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/12 "2003-03-23T03:09:00Z")

</div>

in actionscript [size=1]i think javascript too[/size] you only really need them if you have more than one statement per line.

but it’s a good coding structure. 😉

---

<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:** [March 23, 2003, 4:38am UTC](https://forum.kirupa.com/t/sound-looping-problems/16274/13 "2003-03-23T04:38:04Z")

</div>

Javascript is a bit more picky with it the semi-colons than Actionscript is, and PHP is strict as the d\*\*ickens with it. In AS you don’t need them, but its good coding practice as kax said.
