prevUrl = null; //store current url in global variable isPlaying = false; // store playstate in global variable // load and/or play sound function playSnd(url){ // check playstate if(isPlaying){ return; // deactivate button during play/load } else { isPlaying = true; } // check if same or new sound if(prevUrl != url){ // new sound soundContainer.loadMovie(url); // sound automatically plays after loading prevUrl = url; } else { // same sound soundContainer.play(); // start sound at last paused } onEnterFrame = showPlayState; // start tracking playstate } // stop both playback and download function stopSnd(){ soundContainer.stop(); // stop playback soundContainer.unloadMovie(); // stop download onEnterFrame = null; // stop tracking playstate isPlaying = false; prevUrl = ""; // clear for next load status = "stopped"; } // assign button events playBtn.onRelease = function () {playSnd(sndurl);} stopBtn.onRelease = stopSnd; // target mc to load SWF into createEmptyMovieClip("soundContainer",1);