Skip to main content
Known Participant
November 27, 2023
Question

How to make music play again when music stop

  • November 27, 2023
  • 2 replies
  • 136 views

I have used the coding action script SoundMixer.stopAll(); to stop my song when going to another frame but when I go back in the previous frame the song doesn't play. I have to be at the first frame again for the song to play. How do I want to make the coding only stop when it reaches the desired frame and return to the frame where there is a song, the song will play again. Actually, I am making a learning application that has three parts is learning, quizzes and games.

This topic has been closed for replies.

2 replies

Participant
December 5, 2023

To maintain continuous song playback when revisiting a frame, you can implement a flag variable to track the song's playback status. This flag will indicate whether the song is currently playing or not. When reaching the frame where you want to stop the song, set the flag to 'false', and when returning to the frame with music, check the flag and play the song if it's not already playing. This ensures the song resumes playing when revisiting the music frame.

kglad
Community Expert
Community Expert
November 28, 2023

you can either use code to a start/stop/replay etc your sound.

 

or you can use the timeline.

 

using both using causes problems for users that have incomplete knowledge of both timeline sounds and coding.

 

for most users, using the timeline is the easiest way to control sound (though it doesn't offer the level of control that coding allows).

 

which do you want to use?

 

p.s. please stop posting duplicate messages.