467,136 Members | 1,378 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,136 developers. It's quick & easy.

sounds on mouseovers that will work with most browsers?

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;
}

Mar 26 '07 #1
  • viewed: 1737
Share:
4 Replies
On 26 Mar, 02:01, "alice" <a...@fearofdolls.comwrote:
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.

Mar 26 '07 #2
"alice" <al***@fearofdolls.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
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!
Mar 26 '07 #3
On Mar 25, 11:41 pm, "Marc" <sorry...@dirtymail.comwrote:
"alice" <a...@fearofdolls.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...


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!- 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.

Mar 26 '07 #4
On Mar 27, 12:24 am, "alice" <a...@fearofdolls.comwrote:
On Mar 25, 11:41 pm, "Marc" <sorry...@dirtymail.comwrote:
"alice" <a...@fearofdolls.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
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!- 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.
it /is/ x-browser, i personally have not used dw code since 2004

Mar 27 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Knocked Wood | last post: by
2 posts views Thread by bsanderson@absoftware.com | last post: by
6 posts views Thread by Jimnbigd | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.