...

View Full Version : Improving Dynamic Menu to work on NS



serendipity
10-13-2003, 07:21 PM
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>

_________________________________-



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum