yet anohter sound mouse over question

K

Kryss

I am trying to create a mouse over with a static gif, an animated gif
and a wav or mp3
per my clients request

I can get te image mouseover, but not the sound.

http://thewargame.com/working/game.htm

Any suggestions are appreciated. At the moment i simply have the mouse
over image up without the sound
Regards,
Kryss

PS oh and it would be nice to be cross browser compliant (those are his
words)
 
A

Andrew Bailey

Hi Kryss,


Here is the script...

<!-- --><bgsound id="soundfiles">
<script language="JavaScript"><!--
var aySound = new Array();

aySound[0] = "../audio/select.wav";
aySound[1] = "../audio/click.wav";

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+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.soundfiles: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>

....and here is the call...

<a href="newpage.html" onMouseOver="playSound(0)"
onMousedown="playSound(1)">BUTTON</a>

Hope that helps

Andy
 
J

Jonathan N. Little

Andrew said:
Hi Kryss,


Here is the script...

<!-- --><bgsound id="soundfiles">
<script language="JavaScript"><!--
var aySound = new Array();

<snipped ancient script>

Haven't seen the LiveAudio plug in since Netscape 4.x and it not
supported by later versions and the Gecko browsers. I have tried to hack
to transfer the old but in to the new browser but it does not work.

2nd Does not work in IE, maybe the new "upgrade" patches that settled
that plug-in patent issue with embedded plug-in is a play here.

In NN4.6 get error

JavaScript Error: http://thewargame.com/working/game.htm, line 51:
this.document.embeds[whSound] has no properties.

I believe if you wish to have multimedia buttons that that flash is
probably your best overall bet maximum support.
 
C

cwdjrxyz

Kryss said:
I am trying to create a mouse over with a static gif, an animated gif
and a wav or mp3
per my clients request

I can get te image mouseover, but not the sound.

http://thewargame.com/working/game.htm

Any suggestions are appreciated. At the moment i simply have the mouse
over image up without the sound
Regards,
Kryss

PS oh and it would be nice to be cross browser compliant (those are his
words)

You can get an image or text onMouseOver for sound for the WMP on
browsers that support ActiveX for the WMP, This means IE browsers and
close relatives with the WMP installed, but not the Mozilla
family(recent Mozilla, Firefox, Netscape) unless they have added a
special third party ActiveX plugin for their browser. Here is an
example at http://www.cwdjr.net/rootold/soundscript.html . It has both
a onMouseOver and link to another page for text, an image, and a tiny
hotspot(period) just under the animated frog. In this case the sound is
selected at random from an array of 11 different wav and midi files.
You likely also could use mp3 and possibly wma. The important thing is
that this method does no harm if you are on a browser that does not
support it - you just do not hear the sound. I dug this up from some
old backups of mine, and the code is old. However it at least validates
as W3C html 4.01 transitional and CSS. You will most likely need to
change the code for a fixed sound URL for each hot image rather than
using the random one on my page. Sorry, but this is the best I have at
hand at the moment. If there is a method that is general for all common
browsers and all common sound players, I have not seen it. But then I
have not researched this subject in a long time.
 
K

Kryss

thank you everyone for your suggestions, this page will have flash
involved as well so perhaps that is the best way to do it but for the
sample sans flash, these will work wonders

this is an awesome place
Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top