PDA

View Full Version : [ F5 ] HOW do I limit a sound loop?



nunaat
November 29th, 2002, 11:49 AM
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?

WobblyFork
November 29th, 2002, 12:12 PM
In the first frame of the movie, include a



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


In frame 70, add this code:



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:



moviesound.start();


and in frame 1 add



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

nunaat
November 29th, 2002, 01:18 PM
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.

:) :)

WobblyFork
November 29th, 2002, 01:27 PM
:beam: No problem! Glad I helped.

- wobbly