# \[ F5 \] HOW do I limit a sound loop?

**URL:** <https://forum.kirupa.com/t/f5-how-do-i-limit-a-sound-loop/8846>\
**Category:** flash\
**Created:** [November 29, 2002, 4:49pm UTC](https://forum.kirupa.com/t/f5-how-do-i-limit-a-sound-loop/8846 "2002-11-29T16:49:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nunaat](https://avatars.discourse-cdn.com/v4/letter/n/8baadc/32.png) [@nunaat](https://forum.kirupa.com/u/nunaat)\
**Post date:** [November 29, 2002, 4:49pm UTC](https://forum.kirupa.com/t/f5-how-do-i-limit-a-sound-loop/8846/1 "2002-11-29T16:49:13Z")

</div>

Here’s the situation, I’ll try to be clear and concise:

\*\*Say you have a single-scene 170 frame long movie.  
\*\*The first two frames contain a preloader function.  
\*\*Following the preloader is a very short introduction.  
\*\*Then, the real stuff begins including a background SOUND LOOP that begins at say frame 70.  
\*\*Now here’s the actual problem: I want the sound loop to only play between frames 70 and 170. Nowhere else, especially not over the preloader if someone happens to restart the movie.

-Which is what happens now. It plays fine the first time, but then the loop just keeps going and going no matter what.

I need control. ANY SOLUTIONS?

---

<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:** [November 29, 2002, 5:12pm UTC](https://forum.kirupa.com/t/f5-how-do-i-limit-a-sound-loop/8846/2 "2002-11-29T17:12:59Z")

</div>

In the first frame of the movie, include a

```php

moviesound = new Sound();
moviesound.attachSound("linkage name")

```

In frame 70, add this code:

```php

moviesound.start([1]);

```

This will make it loop only once. If you’d like it to loop constantly until frame 170, however then in frame 70 add only:

```php

moviesound.start();

```

and in frame 1 add

```php

moviesound.stop();

```

idName is the linkage name to your sound clip in the Library. (Click Import to Library from the File menu, then right-click the sound in the library and select “linkage”… make sure Export for ActionScript and Export in First Frame are checked).

This should work!

- wobbly

---

<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:** [November 29, 2002, 6:18pm UTC](https://forum.kirupa.com/t/f5-how-do-i-limit-a-sound-loop/8846/3 "2002-11-29T18:18:04Z")

</div>

Wobblyfork!  
You have just saved me!

“Thank you wobblyfork, you were my only hope!”

Thank you Wobblyfork!  
Days of working up to this one last point which just would not work… ARE OVER.

All I wanna do is to thank you even though I don’t know who you are.

🙂 🙂

---

<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:** [November 29, 2002, 6:27pm UTC](https://forum.kirupa.com/t/f5-how-do-i-limit-a-sound-loop/8846/4 "2002-11-29T18:27:07Z")

</div>

:beam: No problem! Glad I helped.

- wobbly
