music loops


#1

Hi guys, I need some help on a problem, I have a tune that I want to play. I’ve got it playing from the start of the movie. I have a sound on and of switch which set a variable from 1 to 0
on the switch release.

Problem is when I enter a new scene the music gets switched on again. heres the switch code. I have a variable called “playing” which I use to store the value of 1 == play and 0 == stop.

I set this variable once at the start of my movie to 1 (i.e play)

on (release) {
if (Number(playing) == 0) {
stopAllSounds();
tellTarget ("/tune") {
gotoAndStop(“Stop”);
}
playing = 1;
} else {
tellTarget ("/tune") {
gotoAndStop(“Play”);
}
playing = 0;
}
}

Thanks for your help guys.


#2

Hey I solved my own problem. It came down to using two movie files. One with my scenes in and one with the music. Then in the scenes movie I load the music file, thats the .swf in the first frame
and away we go.

Sorted.

:beer:


#3

Glad to hear that you figured it out. Another option would have been to use a global variable.

_global.playing = 0;

#4

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.