sounds on mouseovers that will work with most browsers?

A

alice

I'm trying to get sounds to play on image mouseovers using dreamweaver
8, and I found out that the code it generates to do this only works
for IE. Is there a way to do this so that it will work with most of
the popular browsers? I don't care if it can be done with dreamweaver
or if I have to hand code or copy code from somewhere, I just want it
to work.
Here is what DW creates
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj != null) {
if (navigator.appName == 'Netscape') method = "play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;
}
 
S

shimmyshack

I'm trying to get sounds to play on image mouseovers using dreamweaver
8, and I found out that the code it generates to do this only works
for IE. Is there a way to do this so that it will work with most of
the popular browsers? I don't care if it can be done with dreamweaver
or if I have to hand code or copy code from somewhere, I just want it
to work.
Here is what DW creates
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj != null) {
if (navigator.appName == 'Netscape') method = "play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;

}

if mp3 files you /could/ do this using a hidden iframe, and just
dynamically set the src attribute to a flash player with autostart
enabled.
http://musicplayer.sourceforge.net/ would be useful here.
you could use lame to change from wav to mp3. (-mm mono)
lame --priority 1 --resample 22050 -b40 -mm audio.wav audio.mp3
while mplayer or vlc would probably convert from mid to wav/mp3 as
well
I know this isn't a pretty method but it can work well.
I use a README in conjunction with apache fancy indexing to provide a
javascript function which attaches to all links of mimetype mp3,
setting the target of the link to point to an iframe of this type in
the README include, then I can just use standard apache indexing to
provide browseable interface to stream the colleciton.
 
M

Marc

alice said:
I'm trying to get sounds to play on image mouseovers using dreamweaver
8, and I found out that the code it generates to do this only works
for IE. Is there a way to do this so that it will work with most of
the popular browsers? I don't care if it can be done with dreamweaver
or if I have to hand code or copy code from somewhere, I just want it
to work.
Here is what DW creates
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj != null) {
if (navigator.appName == 'Netscape') method = "play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;
}

You could use flash: http://www.flashsoundapi.com/?preload=true
Works pretty good, check the samples!
 
A

alice

You could use flash:http://www.flashsoundapi.com/?preload=true
Works pretty good, check the samples!- Hide quoted text -

- Show quoted text -

That looks like it might just be the answer, but part of me still
wants to know if there is a way to get create a javascript mouseover
that plays a sound that works in Safari and Firefox. It seems to me
like this would be possible, but then that code may, of course, not
work in IE.
 
S

shimmyshack

That looks like it might just be the answer, but part of me still
wants to know if there is a way to get create a javascript mouseover
that plays a sound that works in Safari and Firefox. It seems to me
like this would be possible, but then that code may, of course, not
work in IE.

it /is/ x-browser, i personally have not used dw code since 2004
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top