/    Sign up×
Community /Pin to ProfileBookmark

sound problem

I wonder if thereis anybody who can look at this file and get the sound funtion to work!

Any help will be great!!

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

[SIZE=1]

[CODE] HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content=”text/html; charset=windows-1254″>
[B]
<SCRIPT language=JavaScript><!–
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at [url]http://jsarchive.8m.com[/url]

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> [/B]
<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”;
;
[B]
[COLOR=red]onclick = playSound(0) [/COLOR]
[/B]
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”;
;
[B]
[COLOR=red]onclick = playSound(1); [/COLOR] [/B]
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();”);
[B]
[COLOR=red]onclick = playSound(); [/COLOR] [/B]
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 + “)”);
[B]
[COLOR=red]onclick = playSound() [/COLOR]
;
[/B]
oCell.innerHTML = term.lemma
}

}

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

}

</SCRIPT>

</BODY></HTML>
[/CODE]

[/SIZE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JJul 11.2003 — I am certain it is to do with the way you have included

[COLOR=red]onclick = playSound(0) [/COLOR] etc

in the second script

try adding one to this line

newArea.onclick = new Function("defineTermIDWithLock(" + term.id + ");this.blur();[COLOR=red]onclick = playSound(0) [/COLOR]");

comment out the others first, just to test my theory
Copy linkTweet thisAlerts:
@mazivendauthorJul 11.2003 — 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...
×

Success!

Help @mazivend spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...