flashdudette
04-29-2003, 06:51 PM
This project is a course with several chapters. Each chapter is loaded into its own asp file into the parent window. I want the user to be able to turn the voice on and off across several movies.
We are using ASP.
I have a session variable (voiceId) set to true when the first
movie loads and the following code in Flash in frame 1 of each movie (though the voices file names are different):
loadVariablesNum("../../getvoiceid.asp", 0);
// make sure any other loaded voice from other frames is
//not playing when returning to frame 1 in a movie.
myVoice.stop();
// create sound object and load it
myVoice = new Sound(this);
myVoice.loadSound("sound/voice1.mp3", true);
// check voiceId status and take action
if (voiceId == false) {
myVoice.stop();
voiceId = false;
vs.vplayB._visible = true; // checkmark btn meaning voice off
} else if (voiceId == true) {
myVoice.start();
voiceId = true;
vs.vplayB._visible = false; // shows stop btn meanig voice on
}
// when clicked, the buttons send the status of the voice ID
// and change the button to reflect the status
// voice is stopped
vs.vstopB.onRelease = function() {
myVoice.stop();
voiceId = false;
loadVariablesNum("../../readvoiceid.asp", 0, "POST"); // send
vs.vplayB._visible = true; // show check mark
};
// voice is played
vs.vplayB.onRelease = function() {
if (playvoice == false && soundIsLoaded == 1) {
myVoice.start(0, 0);
playVoice = true;
_root.speaker.gotoAndPlay("speakerOn");
vs.vplayB._visible = false;
}
};
Only here is the problem.
When I load the first movie, the variable VoiceId = true
If I click on the off button, the variable is set to false properly and the voice stops playing. If I click on play it plays again and teh variable is set to true. (I put a dynamic text with the voiceId variable on the stage to check its value) So the code for on/off works
Now if I click on stop again and go to the next movie, though the variable reads false, the voice file plays and the button does not reflect the off status. If I go back to the first movie, again the voiceId is false but the voice plays.
Can someone tell me why?
We are using ASP.
I have a session variable (voiceId) set to true when the first
movie loads and the following code in Flash in frame 1 of each movie (though the voices file names are different):
loadVariablesNum("../../getvoiceid.asp", 0);
// make sure any other loaded voice from other frames is
//not playing when returning to frame 1 in a movie.
myVoice.stop();
// create sound object and load it
myVoice = new Sound(this);
myVoice.loadSound("sound/voice1.mp3", true);
// check voiceId status and take action
if (voiceId == false) {
myVoice.stop();
voiceId = false;
vs.vplayB._visible = true; // checkmark btn meaning voice off
} else if (voiceId == true) {
myVoice.start();
voiceId = true;
vs.vplayB._visible = false; // shows stop btn meanig voice on
}
// when clicked, the buttons send the status of the voice ID
// and change the button to reflect the status
// voice is stopped
vs.vstopB.onRelease = function() {
myVoice.stop();
voiceId = false;
loadVariablesNum("../../readvoiceid.asp", 0, "POST"); // send
vs.vplayB._visible = true; // show check mark
};
// voice is played
vs.vplayB.onRelease = function() {
if (playvoice == false && soundIsLoaded == 1) {
myVoice.start(0, 0);
playVoice = true;
_root.speaker.gotoAndPlay("speakerOn");
vs.vplayB._visible = false;
}
};
Only here is the problem.
When I load the first movie, the variable VoiceId = true
If I click on the off button, the variable is set to false properly and the voice stops playing. If I click on play it plays again and teh variable is set to true. (I put a dynamic text with the voiceId variable on the stage to check its value) So the code for on/off works
Now if I click on stop again and go to the next movie, though the variable reads false, the voice file plays and the button does not reflect the off status. If I go back to the first movie, again the voiceId is false but the voice plays.
Can someone tell me why?