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

    Improving Dynamic Menu to work on NS

    I'm currently using the script below to put different sounds on different mouse-events, the obvious problem is it doesn't work on Netscape7.+ (no sound whatsover). The other problem is...well, it kinda messes up the "smoothness" of the mouse-over transition (see the blinky?) when I mouseover the Menu. Please download attached zipped file to better appreciate (at the very least you'd get some sword sounds)

    How can I improve on this and how can I make it work on NS?

    ___________________________________
    <script language="JavaScript">

    var aySound = new Array();
    // Below: source for sound files to be preloaded
    aySound[0] = "swordpoint_0.wav";
    aySound[1] = "swordecho_1.wav";
    aySound[2] = "swordclash_2.wav";
    aySound[3] = "swordstrike_3.wav";


    // DO NOT edit below this line
    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 (window.auCon) auCon.control(whSound,true); }
    function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
    </script>
    <body onload="auPreload();menuBarInit();makeActiveInit()">
    <div id="content"> <span id="menu1">
    <div class="menu1" id="menuTitle1" onmouseover="ColorChange(1,1,2,3,4,5);showFilter('subMenu1','visible');playSound(0)" onmouseout="ColorChange(1,1,2,3,4,5);showHide('subMenu1','hidden');stopSound(0)" onClick="ColorSelect(1,1,2,3,4,5);playSound(2)" >MENU1</div>

    _________________________________-
    Attached Files Attached Files
    Thanks in advance for any replies! :)


 

Posting Permissions

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