PDA

View Full Version : Stop sound with ActionScript



Anataya
April 11th, 2009, 11:34 PM
I've got a movie where there's an audio file looping throughout it (across many different scenes) and in the final scene I need it to stop playing at a particular frame. I've tried a few different things with ActionScript (2) but haven't gotten anywhere. I googled what I wanted to do but most of the results involved buttons - I want this sound to stop when I get to a particular frame, and allow the other sounds to continue playing. I figure it's only a few lines of AS but I don't know what's right. Currently I have this:

onClipEvent (enterFrame) {
busInterior.stop(); }

Which doesn't make the compiler happy (Clip events are permitted only for movie clip instances). I have the audio file in a movie clip at the moment 'cause I read somwhere that that made things easier, and I wasn't sure that it would work if I just put the name of the MP3 file in anyway.

countersweet
April 12th, 2009, 07:33 AM
where is your busInterior located? locally or in _root?

you just click to the specific frame where the sound should stop, click actinos and paste this in it
busInterior.stop()

Anataya
April 12th, 2009, 09:35 AM
It's just in the library. I had that before and the compiler didn't complain, but it didn't work when I tested the movie either. I'll try again though... with and without the mp3 in a movie clip.

countersweet
April 12th, 2009, 10:32 AM
ohh sound, damn i got lost in the middle of your post.

stopAllSounds();

if you don't wish to stop all sounds, you will have to re-make the flash so that it would use sound classes

Anataya
April 12th, 2009, 04:10 PM
Yeah, stopAllSounds isn't an option because I have other sound playing at the same time and want that to continue to run. Remaking it isn't an option, this is a four minute long animated movie with a lot of sound timed to very specific points; I'm not doing it all over again. I can't believe there isn't a way to stop a specific mp3 at a certain frame, even a movie clip with sound in it? I feel like there has to be something you can do with AS to accomplish this.

countersweet
April 17th, 2009, 07:36 AM
well there is a way to do it, but you need to use sound classes for it (: and you apparently didn't

you can google around if you wish, but i think this is the only way how to manipulate specific sound in flash