I’ve got a problem. And it’s a pretty bad one too. I have a mp3 player in a stand alone swf that I load into level 30 (or something). It works just fine, plays music and stop when I click the button. However, it CONTINUES to play AFTER I have left my site and are browsing other pages, and at that point you have no way of turning it off. This is if course a big problem and I have taken the music.swf down for the time being. Here’s the code that I used:
[FONT=monospace]stop();
// Preloader variables
var t = 0;
var l = 0;
var p = 0;
// Stop the stop button from morphing
//this.control.gotoAndStop(1);
// --------------------------<load and loop sound>-------------------------- \\
this.createTextField("status_txt", this.getNextHighestDepth(), 72, 630, 100, 22);
// create a new Sound object
var my_sound:Sound = new Sound();
musictext.text = "loading";
// if the sound loads, play it; if not, trace failure loading
my_sound.onLoad = function(success:Boolean) {
if (success) {
my_sound.start();
musictext.text = "music off";
_root.preloader._visible = false;
} else {
status_txt.text = "Sound failed";
}
};
// load the sound
myCount = 0;
totCount = 0;
mySongs = ['pacha2.mp3'];
nextTrack = function () {
my_sound.loadSound(mySongs[myCount], false);
this.onEnterFrame = function() {
//trace(t);
//trace(p);
//trace(l);
t = my_sound.getBytesTotal();
l = my_sound.getBytesLoaded();
if ((t>0) && (t != null)) {
p = (l/t)*100;
p = int(p)+1;
preloader.gotoAndStop(p);
}
if (l == t) {
delete this.onEnterFrame;
}
};
};
// loop the sound
my_sound.onSoundComplete = function() {
my_sound.start();
};
// --------------------------</load and loop sound>-------------------------- \\
// ------------------------------<Play Stop button function>------------------------------ \\
var playstat:String;
playstat = 'on';
control.onRelease = function() {
if (playstat != 'off') {
//gotoAndStop(2);
playstat = 'off';
my_sound.stop();
musictext.text = "music on";
_root.control.gotoAndStop(2);
//trace (playstat);
} else if (playstat != 'on') {
//gotoAndStop(1);
playstat = 'on';
my_sound.start();
musictext.text = "music off";
this.nextTrack();
_root.control.gotoAndStop(1);
//_root.preloader._visible = true;
//trace (playstat);
//trace(mySongs[myCount]);
}
};
nxt_btn.onRelease = function() {
if (myCount == totCount) {
myCount = 0;
} else {
myCount++;
}
nextTrack();
_root.preloader._visible = true;
trace(myCount);
};
prev_btn.onRelease = function() {
if (myCount == 0) {
myCount = totCount;
} else {
myCount--;
}
nextTrack();
_root.preloader._visible = true;
trace(myCount);
};
nextTrack();
[/FONT]So, what is happening here? Why does it continue to play when I leave my site. I would grately appriciate any help on this. thx in advance.