ASP
06-09-2003, 04:05 AM
Greetings...
I'd like to create a JavaScript function that will prompt the client to open/save a sound file. Opening the sound file would then open the client's default media player.
I've examined the code generated by the PlaySound Behavior in Dreamweaver MX. It is listed below.
==============================================
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;
}
}
//-->
</script>
</head>
<body onLoad="MM_controlSound('play','document.CS1055118834968','<some sound file')">
<EMBED NAME='CS1055118834968' SRC='<some sound file' LOOP=false
AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED>
==============================================
How does the "onLoad() function know to pass 'document.CS1055118834968' as the second argument to the function "MM_controlSound". Furthermore, how I would be able to pass an argument that defines the client's default media player.
Secondly, my understanding is that the <embed> tag is no longer supported in NN7. More to the point, if the objective is to prompt the client to open the default media player for the sound file to play, why use an <embed> tag at all?
Your feedback is greatly appreciated.
Respectfully,
ASP
I'd like to create a JavaScript function that will prompt the client to open/save a sound file. Opening the sound file would then open the client's default media player.
I've examined the code generated by the PlaySound Behavior in Dreamweaver MX. It is listed below.
==============================================
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;
}
}
//-->
</script>
</head>
<body onLoad="MM_controlSound('play','document.CS1055118834968','<some sound file')">
<EMBED NAME='CS1055118834968' SRC='<some sound file' LOOP=false
AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0></EMBED>
==============================================
How does the "onLoad() function know to pass 'document.CS1055118834968' as the second argument to the function "MM_controlSound". Furthermore, how I would be able to pass an argument that defines the client's default media player.
Secondly, my understanding is that the <embed> tag is no longer supported in NN7. More to the point, if the objective is to prompt the client to open the default media player for the sound file to play, why use an <embed> tag at all?
Your feedback is greatly appreciated.
Respectfully,
ASP