Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Sound restarting at Home label



10:34 pm on Sep 4, 2009 (gmt 0)

5+ Year Member

I got the sound to play through the different labels. I just can't seem to figure out why it starts over when I go over to the Home Label. I'm guessing I have to some how check and see if the file is playing and if it is then create some if else statement. I just don't know how to do it.

Home Label action

var mySound:Sound = new Sound(this);
mySound.loadSound("music/music.mp3", true);//Set true to stream
mySound.onSoundComplete = function() {//loop it


7:03 pm on Sep 5, 2009 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Being your label action, whenever you hit the label it's creating a new instance of the sound and playing it, overwriting the old same-named instance.

What might be better is to define the sound and sound source in the first frame then hit play on mouse over of label?

Here's a quick copy/paste from one of my players, but it has a start and stop button. The start/stop buttons are on top of each other, so when playing it turns into a stop button and vice versa. You can guess the other symbols I have by what I've named them. All in an actions layer, entire player is one frame.

var soundOn;
mySound = new Sound();
mySound.onSoundComplete = function() { toggleSound(); };
function toggleSound() {
if (soundOn==1) {
else {


4:46 pm on Sep 11, 2009 (gmt 0)

5+ Year Member

Thanks I ended up just making the sound file to its on clip and loading it

Featured Threads

Hot Threads This Week

Hot Threads This Month