wyclef
05-27-2003, 05:07 PM
Hi, I'm having trouble with this script. I'm trying to set it up so if a sound is already playing, and you click on a button that should be playing the same sound it just keeps playing instead of starting over, but the only result i get out of this script is a sound plays once only when you press the mouse button down and then when you release the mouse button no sounds will play anymore. Your help would be appreciated, thanks.
overSound = new Sound();
overSound.attachSound("sound1");
clickSound = new Sound();
clickSound.attachSound("sound2");
infoSound = new Sound();
infoSound.attachSound("info");
mediaSound = new Sound();
mediaSound.attachSound("media");
contactSound = new Sound();
contactSound.attachSound("contact");
linksSound = new Sound();
linksSound.attachSound("links");
merchandiseSound = new Sound();
merchandiseSound.attachSound("merchandise");
homeSound = new Sound();
homeSound.attachSound("home");
mySounds = [infoSound, mediaSound, contactSound, linksSound, merchandiseSound];
biography_btn.onRollOver = news_btn.onRollOver = events_btn.onRollOver = function() {
overSound.start(0, 1);
};
biography_btn.onPress = news_btn.onPress = events_btn.onPress = function() {
clickSound.start(0, 1);
if (alreadyPlaying != true) {
infoSound.start(0, 999);
alreadyPlaying = true;
}
};
biography_btn.onRelease = function() {
gotoAndPlay(15);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
news_btn.onRelease = function() {
gotoAndPlay(17);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
events_btn.onRelease = function() {
gotoAndPlay(19);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
photos_btn.onRollOver = audio_btn.onRollOver = video_btn.onRollOver = function() {
overSound.start(0, 1);
};
photos_btn.onPress = audio_btn.onPress = video_btn.onPress = function() {
clickSound.start(0, 1);
if (alreadyPlaying != true) {
mediaSound.start(0, 999);
alreadyPlaying = true;
}
};
photos_btn.onRelease = function() {
gotoAndPlay(30);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
audio_btn.onRelease = function() {
gotoAndPlay(32);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
video_btn.onRelease = function() {
gotoAndPlay(34);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
overSound = new Sound();
overSound.attachSound("sound1");
clickSound = new Sound();
clickSound.attachSound("sound2");
infoSound = new Sound();
infoSound.attachSound("info");
mediaSound = new Sound();
mediaSound.attachSound("media");
contactSound = new Sound();
contactSound.attachSound("contact");
linksSound = new Sound();
linksSound.attachSound("links");
merchandiseSound = new Sound();
merchandiseSound.attachSound("merchandise");
homeSound = new Sound();
homeSound.attachSound("home");
mySounds = [infoSound, mediaSound, contactSound, linksSound, merchandiseSound];
biography_btn.onRollOver = news_btn.onRollOver = events_btn.onRollOver = function() {
overSound.start(0, 1);
};
biography_btn.onPress = news_btn.onPress = events_btn.onPress = function() {
clickSound.start(0, 1);
if (alreadyPlaying != true) {
infoSound.start(0, 999);
alreadyPlaying = true;
}
};
biography_btn.onRelease = function() {
gotoAndPlay(15);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
news_btn.onRelease = function() {
gotoAndPlay(17);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
events_btn.onRelease = function() {
gotoAndPlay(19);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
photos_btn.onRollOver = audio_btn.onRollOver = video_btn.onRollOver = function() {
overSound.start(0, 1);
};
photos_btn.onPress = audio_btn.onPress = video_btn.onPress = function() {
clickSound.start(0, 1);
if (alreadyPlaying != true) {
mediaSound.start(0, 999);
alreadyPlaying = true;
}
};
photos_btn.onRelease = function() {
gotoAndPlay(30);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
audio_btn.onRelease = function() {
gotoAndPlay(32);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};
video_btn.onRelease = function() {
gotoAndPlay(34);
for(var i=0;i<this._parent.mySounds.length;i++){
this._parent.mySounds[i].stop();
image_loader.unloadMovie();
}
};