Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I am having issue with IE and Javascript.

I have a AdobeShockwave file which fires an event after movie is completed.
This event can be captured by Javascript/VB Script.

I am able to capture the events in the Debug mode only using IE developer tools.

If I don't place a Breakpoint, functions are not fired. below is the code which I have tried

Please help me....
HTML
<html>
<head>
    <title>Example</title>
	
	<script FOR="DcrObj" EVENT="externalEvent(aParam)" LANGUAGE="javascript">
		alert("Check this out: javascript ");
    </script>
	
	<script FOR="DcrObj" EVENT="externalEvent(aParam)" type="text/javascript">
		alert("Check this out: text/javascript");
    </script>
	
	<script type="text/javascript">
    	function onEventHandler(event)
    	{
    	    alert("Hurrey New option::: attachEvent");
    	}
    	window.onload = function()
    	{
    	    var yourActiveXObject = document.getElementById('DcrObj');
    	    if(typeof(yourActiveXObject) === 'undefined' || yourActiveXObject === null){
    	        alert('Unable to load ActiveX');
    	        return;
    	    }
    	    else
    	    {
    	        if (window.addEventListener) {  // all browsers except IE before version 9
    	            yourActiveXObject.addEventListener('externalEvent',onEventHandler,true)
    	        }
    	        if (window.attachEvent) {   // IE before version 9
    	            yourActiveXObject.attachEvent('externalEvent', onEventHandler);
    	        }
    	    }
    	}
	</script>	
</head>
<body >
<div id="flashContent"> 
	<object width="800"  height="600" id="DcrObj" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab"
                    classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000">
		<param name="swStretchStyle" value="meet" />
		<param value="OverView02.dcr" name="src">
		<embed width="100%" height="100%" src="OverView02.dcr" pluginspage="http://www.macromedia.com/shockwave/download/">
	</object>  
</param></div>
</body>
</html>
Posted
Updated 24-Sep-13 0:08am
v3
Comments
enhzflep 23-Sep-13 10:33am    
Bit hard to say without the SWF on hand to test with.
While wrapping your code with <pre lang='HTML'> ..content.. <pre> tags, I noticed that you don't have a doctype tag in your code. From memory, ommitting this tag can alter the mode that IE selects to use in order to display your page. I don't know that I think it's and especially likely culprit in this case, however, you should have a <!doctype html> tag as the first element in the file (assuming HTML5) - in cases of older versions of html, you should look-up and apply the relevant doctype declaration.
Can you see any Errors in Console Window of Developer Tool?
Thomas Barbare 24-Sep-13 6:19am    
I'm agree with enhzflep. You should correct this error : <body >
It will not solve your problem but this added space can cause some errors

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900