View Single Post
Old 03-21-2004, 02:12 PM   #13 (permalink)
RelaX
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
I thought that might happen, should've done it right the first time around. Now it first checks if the sound object is actually instantiated yet. I even tested it this time, this works fine for me.
I also changed it to alert a Netscape (or Mozilla) user that it will not work for his/her browser.

Code:
<script language="JavaScript">
<!--
//v3.0
function MM_controlSound(x, _sndObj, sndFile)
{
	var i;
	var method = "";
	var sndObj = eval(_sndObj);
	
	if (sndObj != null)
	{
		if (navigator.appName == 'Netscape')
		{
                         alert("My appologies, this functionality is reserved for Internet Explorer users only");
			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)
	{
		if (sndObj != null)
		{
			eval(_sndObj+".stop()");
		}
		eval(_sndObj+"."+method+"()");
	}
	
	else
	{
		window.location = sndFile;
	}
}
//-->
</script>
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein

Last edited by RelaX; 03-21-2004 at 02:22 PM..
RelaX is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62