Skip to main content
francisrayAS3
Participant
May 14, 2017
Question

How to stop background music from duplicating/repeating when navigating throughout the scenes

  • May 14, 2017
  • 1 reply
  • 621 views

I have background music and everytime I navigate back to the homepage it repeats and plays ontop of the other. How do I write the code to make it so the music plays throughout all the scenes with out it duplicated whenever going back to the home screen?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 14, 2017

assign your sound a linkage id=class name (in your library panel) by right clicking > click properties > tick export for actionscript.

in your actions panel use,

var s:Sound;

if(!s){

s = new WhateverClassName();

s.play();

}