Click to See Complete Forum and Search --> : sound problem


mazivend
07-11-2003, 11:43 AM
I wonder if thereis anybody who can look at this file and get the sound funtion to work!

Any help will be great!!

This part of the script with the playSoung() working properly but when puting it in the other script part its not working:
What's worng!!




HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1254">

<SCRIPT language=JavaScript><!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com

var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = "test1.mp3";
aySound[1] = "test2.mp3";
aySound[2] = "test3.mp3";
// DO NOT edit below this line

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>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
</STYLE>
</HEAD>
<BODY><A name=top></A>
<TABLE class=clsPageTable id=maintable cols=2>


<SCRIPT lang=JavaScript>var currentTerm = null;
;
var lockedForTermID = 0;
;
var lineVisible = null;
;
var oMainImage = new Object();
;
oMainImage.url = "images/animage.jpg";
oMainImage.initialEntryID = 0;
oMainImage.origWidth = 1400;
oMainImage.origHeight = 988;
var terms = new Array();
;
var term = new Object();
;
term.imgAreaCoords = new Array();
term.id = 8815;
;
term.lemma = "Test1";
;

onclick = playSound(0)

term.coordPointX = 207/2;
;
term.coordPointY = 1081/2;
;
term.termCell = null;
;
terms[terms.length] = term;
;
term.imgAreaCoords = new Array();
term.imgAreaCoords[0] = new Array(129, 590, 144, 588, 153, 590, 156, 596, 160, 591);
var term = new Object();
;
term.imgAreaCoords = new Array();
term.id = 8774;
;
term.lemma = "Test2";
;

onclick = playSound(1);
term.coordPointX = 611;
;
term.coordPointY = 179;
;
term.termCell = null;
;
terms[terms.length] = term;
;
term.imgAreaCoords = new Array();
term.imgAreaCoords[0] = new Array(612, 279, 618, 284, 626, 285, 629, 281, 626, 252);


function createImgAreas() {
imgMap.innerHTML = "";
var e = new Enumerator(terms);
;
for (; !(e.atEnd()); e.moveNext()) {
term = e.item();
var enumCoords = new Enumerator(term.imgAreaCoords);
;
for (; !(enumCoords.atEnd()); enumCoords.moveNext()) {
coords = enumCoords.item();
if (2 < coords.length) {
var newArea = document.createElement("AREA");
;
newArea.onclick = new Function("defineTermIDWithLock(" + term.id + ");this.blur();");

onclick = playSound();
newArea.shape = coordsShape(coords);
newArea.url = "";
var coordString = "";
;
var e2 = new Enumerator(coords);
;
for (; !(e2.atEnd()); e2.moveNext()) {
var x_or_y = e2.item();
;
x_or_y = Math.round(currentMagnification() * x_or_y);
coordString = coordString + x_or_y + ","
}
;
coordString = coordString.substring(0, coordString.length - 1);
newArea.coords = coordString;
newArea.href = "javascript:";
imgMap.appendChild(newArea)
}

}

}

}

function createLemmaList() {
var e = new Enumerator(terms);
;
for (; !(e.atEnd()); e.moveNext()) {
term = e.item();
var oRow = wordsarea.insertRow();
;
var oCell = oRow.insertCell();
;
term.termCell = oCell;
null;
oCell.onclick = new Function("defineTermIDWithLock(" + term.id + ")");

onclick = playSound()
;

oCell.innerHTML = term.lemma
}

}

function initialize() {
createLemmaList();
createImgAreas();
if (oMainImage.initialEntryID) {
return (defineTermIDWithLock(oMainImage.initialEntryID))
}

}


</SCRIPT>


</BODY></HTML>

Mr J
07-11-2003, 03:00 PM
I am certain it is to do with the way you have included

onclick = playSound(0) etc

in the second script

try adding one to this line

newArea.onclick = new Function("defineTermIDWithLock(" + term.id + ");this.blur();onclick = playSound(0) ");

comment out the others first, just to test my theory

mazivend
07-11-2003, 04:24 PM
Thanks for ur reply!
I replaced this line with the one you sended

//newArea.onclick = new Function("defineTermIDWithLock(" + term.id + ");this.blur();");

newArea.onclick = new Function("defineTermIDWithLock(" + term.id + ");this.blur();onclick = playSound(0) ");

but unfortunately nothing happening! :(

Can I send over the hole file with the sounds?

thanks a lot...