...

View Full Version : "STOP!" Is it possible?



lisabella3686
07-27-2002, 01:39 AM
Hello Everyone!

My site is in a pop-up window with no navigation bar and I was wondering if it is possible to have a "stop" button because I have music that plays on my site and I don't want a bulky music player embedded.

here is my site:
http://lisabella.narlhosting.co.uk/inen.htm

My music in wma form and it becomes annoying to listen to over and over while viewing my site for extended periods of time.

BrightNail
07-27-2002, 01:53 AM
you can try this...put your sound file in there instead of the one I have...


var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "sounds/sewing5sec04.wav";

// DO NOT edit below this line
if(navigator.userAgent.indexOf('Win')!= -1){
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;
}
function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if(navigator.userAgent.indexOf('Mac')!= -1){return;}if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if(navigator.userAgent.indexOf('Mac')!= -1){return;}if (window.auCon) auCon.control(whSound,false); }
//-->

to stop it....
put this on your button
onMouseOut="stopSound(0)"

this doesn't work on a MAC though..

lisabella3686
07-27-2002, 01:57 AM
Originally posted by BrightNail
to stop it....
put this on your button
onMouseOut="stopSound(0)"

this doesn't work on a MAC though..

thanx...but which button would that be?

BrightNail
07-27-2002, 08:10 AM
huh?

in your question, you asked if you could have a stop button...

well, I am referring to "that" button...whatever button you create...just add that function..ala

just add a onMouseOut or even a onClick event handler.....

Pooh
07-27-2002, 08:42 AM
What's that a mouseover script?


<EMBED SRC="http://lisabella.narlhosting.co.uk/N.O.R.E. - Nothin'.wma" AUTOSTART="true" hidden="true" name="myMuzac">
<input type="button" value="Stop music" onclick="myMuzac.stop()">
<input type="button" value="Play music" onclick="myMuzac.play()">

lisabella3686
07-27-2002, 07:09 PM
what i meant by a "stop" button is a button that would be equivilant to the "stop" button on the Internet Explorer bar.

I'm not sure what type of script that is, but it didn't work for me..unless I did something wrong.

I assumed that I had to add
(script>
(/script> (with 2 <> )

but I'm not sure if that was the right move.

Pooh
07-27-2002, 08:30 PM
This code is a copy and paste:

<EMBED SRC="http://lisabella.narlhosting.co.uk/N.O.R.E. - Nothin'.wma" AUTOSTART="true" hidden="true" name="myMuzac">
<input type="button" value="Stop music" onclick="myMuzac.stop()">
<input type="button" value="Play music" onclick="myMuzac.play()">


Just remove the bgsound code that you have and replace it with the above. It will ad two buttons, one to stop the music and one to start it again. Your music will still play automatically onload. You can replace the buttons with any images.

lisabella3686
07-27-2002, 10:19 PM
oh kewl..thanx :)

it works like a charm

gorilla1
07-28-2002, 01:59 AM
I am guessing that that won't work for midi files?
G



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum