Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Ontario, Canada
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question "STOP!" Is it possible?

    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.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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..

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Ontario, Canada
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.....

  • #5
    New Coder
    Join Date
    Jul 2002
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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()">

  • #6
    New Coder
    Join Date
    Jul 2002
    Location
    Ontario, Canada
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #7
    New Coder
    Join Date
    Jul 2002
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    New Coder
    Join Date
    Jul 2002
    Location
    Ontario, Canada
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh kewl..thanx

    it works like a charm

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am guessing that that won't work for midi files?
    G


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •