Background Music Looping problem

3 posts

Flag Post

My background music is looping repeatedly so that it creates an echo of noise. Pretty sure this is because it’s in ‘OnEnterFrame’. Is there a way to make sure your BG music plays through once, before repeating. I followed the method in lesson 8 but they don’t show you where in the code they placed this particular bit of code. Ideas? Suggestions?

Flag Post


Flag Post

Yes, starting the sound every frame is probably a bad idea. You will want to start and stop the sound in locations that will only be triggered at specific times: constructors, button-click listeners, level start and finish handlers, etc. The best location will depend on how your program is structured.

For the looping, you’ll either want to specify a large number number of loops when calling start() or to restart the sound in the sound’s onSoundComplete listener.

EDIT: I didn’t realize what forum this was in, so you might get more specific information from someone who has gone through the Shootorials.