Copy link to clipboard
Copied
Hello everyone. I'm having trouble with some sound on my Timeline. I'm sure there is a code to get it the way I want but I don'y know it.
So basically here is what I want.
On the Layer "Beat" I have music set on Stream because I want it to play forever.
When I get to Frame 5 "S1 Multi" The sounds and animation for that MC plays fine. Also Beat Continues to play like I want.
On Frame 5 I also have a button that is stand alone. On its own layer. If you click it, it navigates you to the next MC on Frame 6 "S2 Fly"
The problem is. The music gets carried over from Frame 5 "S1 Multi" and jumbles in with Frame 6 "S2 Fly" because it doesn't know it needs to stop.
But if I insert a :
import flash.media.SoundMixer;
SoundMixer.stopAll();
It will also stop "Beat" which I want to play forever.
So I can't find a way to stop music playing within a Move Clip. That way it doesn't carry on into another Movie Clip.
Here's a different approach:
Make the sounds inside the movieclips be Stream.
Make Beat be Event, and looped.
In the script that takes you from frame 5 to 6, include something that stop "S1 Multi" and starts playing "S3 Fly" after you have gone to frame 6.
Something like:
btn.addEventListener(MouseEvent.CLICK, gosix);
function gosix(e:MouseEvent){
btn.removeEventListener(MouseEvent.CLICK, gosix);
s1multi.stop();
gotoAndStop(6);
s3fly.play();
}
The s1multi and s3fly would be the names you have giv
...Copy link to clipboard
Copied
Timmonsxp wrote
On the Layer "Beat" I have music set on Stream because I want it to play forever.
That's the opposite of what Stream does. Stream locks sound playback to the playhead position.
Read the documentation: How to use sound in Adobe Animate CC
- Event plays a sound every time the playhead hits where the sound keyframe is.
- Start plays a sound like Event does, but not if the sound is already playing.
- Stop stops the specified sound.
- Stream syncs sound with the playhead.
Sounds like maybe you need a Stop frame.
Copy link to clipboard
Copied
The Movie Clips are all loops until you navigate to the next Via Button. So stopping it would make the sound go away where ever you place it. So if the user isnt ready to navigate. The sound may or may not stop when they are ready to progress.
Copy link to clipboard
Copied
I need some kind of sound mixer stop all but only for specific movie clips if that were possible. Not sure. haha that's why i'm asking.
Copy link to clipboard
Copied
Timmonsxp wrote
The Movie Clips are all loops until you navigate to the next Via Button. So stopping it would make the sound go away where ever you place it.
Yes, exactly. You asked how to stop a specific timeline sound. That's how you do it.
Copy link to clipboard
Copied
I tried what you said. That defeats the purpose of a loop though. There is no "End Point" for the movieclip. It needs to keep looping until the user is ready. So where can I use the Sync:Stop in the sound properties if there isn't an "Ending Point"? It also doesnt play the sound longer than one frame. (The frame its on) So if a sound rings out for 30 frames it wont play it.
All I need to know is. Is there a way to stop sounds on a looping movieclip so it doesnt progress onto the next movie clip.
I know you can use a
import flash.media.SoundMixer;
SoundMixer.stopAll();
But that makes it to where all the sounds on the entire Timeline stop. And I need the Layer BEAT to play forever.
Copy link to clipboard
Copied
Colin Holgate​ Where you at? Haha. Help me buddy.
Copy link to clipboard
Copied
Here's a different approach:
Make the sounds inside the movieclips be Stream.
Make Beat be Event, and looped.
In the script that takes you from frame 5 to 6, include something that stop "S1 Multi" and starts playing "S3 Fly" after you have gone to frame 6.
Something like:
btn.addEventListener(MouseEvent.CLICK, gosix);
function gosix(e:MouseEvent){
btn.removeEventListener(MouseEvent.CLICK, gosix);
s1multi.stop();
gotoAndStop(6);
s3fly.play();
}
The s1multi and s3fly would be the names you have given the movieclips.
Copy link to clipboard
Copied
I'm using buttons to to take me from 5 to 6.
So basically give the movie clips instance names that way I can stop them specifically with the code you just gave?
Copy link to clipboard
Copied
I copied your code. I renamed the btn. to my button name.
When it runs it gives me an error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Velvet_fla::MainTimeline/gosix()
Copy link to clipboard
Copied
I had a button navigation already in the script and it was getting confused because there were 2 gotoAndStop(); commands. I deleted the code and just used the code you gave me and it works perfectly. Your the best Colin Holgate​
Copy link to clipboard
Copied
Glad you made progress. At some point look into doing all this with code, it isn't too difficult to play a sound in code, and then only stop that one sound. But you can figure that out another day!
Copy link to clipboard
Copied
Timmonsxp wrote
I tried what you said. That defeats the purpose of a loop though. There is no "End Point" for the movieclip. It needs to keep looping until the user is ready. So where can I use the Sync:Stop in the sound properties if there isn't an "Ending Point"?
You put it where the timeline jumps to when the user is ready, obviously.
That being said, any stream sounds will automatically stop playing when their containing clip leaves the stage, so you could also manage them that way.
Copy link to clipboard
Copied
/throws hands up in despair
Copy link to clipboard
Copied
Haha. Thanks both of you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now