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 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question stop sound from a different frame

    I have a htm page who use frame like this:
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <frameset Cols="150,*" border=0>
    <frame name="left" src="menu_sound.htm" marginwidth="10" marginheight="10" scrolling="Auto" frameborder="no" noresize>
    <frame name="right" src="home.htm" marginwidth="10" marginheight="10" scrolling="Auto" frameborder="no" noresize>
    <noframes>
    <body>
    <p>This page uses frames, but your browser doesn't support them.</p>
    </body>
    </noframes>
    </frameset>
    </HEAD>
    <BODY>
    </BODY>

    In menu.htm a have put a background sound (an mp3 file).
    MY PROBLEM:
    How can I stop runing the mp3 file when i load in frame named "right" newpage.htm ?

    Do you have any idea?

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    It might help if you post the code for the left frame so we can see how the mp3 is played

    for media player it would be something like

    onload="parent.left.document.MediaPlayer.Stop()"

    which would be placed in newpage.htm's opening body tag

  • #3
    New Coder
    Join Date
    Feb 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks man !!!

  • #4
    New Coder
    Join Date
    Feb 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is the index page:

    <HTML>
    <HEAD>
    <TITLE>index</TITLE>
    <frameset Cols="150,*" border=0>
    <frame name="left" src="a2.htm" marginwidth="10" marginheight="10" scrolling="Auto" frameborder="no" noresize>
    <frame name="right" src="a3_1.htm" marginwidth="10" marginheight="10" scrolling="Auto" frameborder="no" noresize>
    <noframes>
    <body>
    <p>This page uses frames, but your browser doesn't support them.</p>
    </body>
    </noframes>
    </frameset>
    </HEAD>
    <BODY>
    ------------------------------------------------------------------------------------
    in the right page I have only text.


    this is left page code (a2.htm)

    <HTML>
    <HEAD>
    <TITLE>a2 page</TITLE>
    <script LANGUAGE="JavaScript" SRC="aud.js"></script>
    <script LANGUAGE="JavaScript"><!--
    var aySound = new Array();
    // Below: source for sound files to be preloaded
    aySound[0] = "a1.mp3";

    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;
    //-->
    </script>
    </HEAD>
    <BODY>
    <INPUT TYPE="BUTTON" VALUE="play" onClick="playSound(0)">
    <INPUT TYPE="BUTTON" VALUE="Stop!" onClick="stopSound(0)">
    <br><a href="a3.htm" target="right">stop sound</a>
    </BODY>
    </HTML>
    </BODY>
    </HTML>
    ------------------------------------------------------------------------------------



    this is aud.js code

    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 (window.auCon) auCon.control(whSound,true); }
    function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
    ------------------------------------------------------------------------------------
    At last this is a3.htm code

    <HTML>
    <HEAD>
    <TITLE></TITLE><script LANGUAGE="JavaScript" SRC="aud.js"></script>
    </HEAD>
    <BODY onload="stopSound(0)">
    <center>No sound</center>
    </BODY>
    </HTML>
    --------------------------------------

    Can you see where is the problem?
    Thanks !!!


  • #5
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    In a3.htm try the following




    <HTML>
    <HEAD>
    <TITLE></TITLE>
    </HEAD>

    <BODY onload="parent.left.stopSound(0)">

    <center>No sound</center>
    </BODY>
    </HTML>







  • #6
    New Coder
    Join Date
    Feb 2003
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK!!! Now is good. Thanks !!!


  •  

    Posting Permissions

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