# Problem in controlling sound

**URL:** <https://forum.kirupa.com/t/problem-in-controlling-sound/154854>\
**Category:** Uncategorized\
**Created:** [July 13, 2005, 5:35am UTC](https://forum.kirupa.com/t/problem-in-controlling-sound/154854 "2005-07-13T05:35:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kedar](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kedar](https://forum.kirupa.com/u/kedar)\
**Post date:** [July 13, 2005, 5:35am UTC](https://forum.kirupa.com/t/problem-in-controlling-sound/154854/1 "2005-07-13T05:35:03Z")

</div>

Hi,  
itz massive urgent for me.anyone helps me out solving the pronlem will be highly appreciated.  
i have attached a flash file.the problems are

1. i have palced 2 flash file on my web page.if i stop the sound on this file then the sound on another flash movie placed on my web page also stops.i want both the files to be independent to each other and controlled separately

2)if i click on play it shows loading.even after it loads the file it doesnt change itz status. if i click again on play then itz status changes to play.

my codes for flash…

soundUrl = “test.mp3”;

// create sound object, assign properties and events  
function createSoundObject(){  
translation = new Sound(); // define sound object  
return;  
}  
// create initial sound object  
createSoundObject();

// load and/or play song  
function playSnd(){  
// check playstate  
if(isPlaying){  
status = “playing”;  
tellTarget(“load”){  
gotoAndStop(1)  
}  
return; // deactivate button during play/load  
} else {  
isPlaying = true;  
}  
translation.loadSound(soundUrl,true); // sound automtically plays afer loading  
//status = “loading”;  
tellTarget(“load”){  
gotoAndPlay(2)  
}  
onEnterFrame = showPlayState; // start tracking playstate  
}

// stop both playback and download  
function stopSnd(){  
translation.stop(); // stop playback  
delete translation; // stop download  
createSoundObject(); // create a new sound object  
isPlaying = false;  
onEnterFrame = null; // stop tracking playstate  
status = “stopped”;  
tellTarget(“load”){  
gotoAndStop(1)  
}  
title = “hit play”;  
}  
// pause sound  
function pauseSnd(){  
translation.stop();  
isPlaying = false;  
onEnterFrame = null; // stop tracking playstate  
status = “paused”;  
tellTarget(“load”){  
gotoAndStop(1)  
}  
}  
stopSnd();  
// assign button events  
playBtn.onRelease = function () {  
playSnd();  
}  
pauseBtn.onRelease = function () {  
pauseSnd();  
}  
stopBtn.onRelease = function () {  
stopSnd();  
}  
stop(); // prevent timeline looping
