External Interface, Internet Explorer and Time Wasted

Dear Googlers,

I leave this message for you in the case that you encounter a similar obstacle to your productivity. Internet Explorers 6, 7 and 8 do not like uppercase letters (or hyphens) in the object ID when embedding a swf into the page if you then plan on using the code with ExternalInterface. They do not like it with SWFObject or with the simple old fashioned object tag. The solution was elusive, but there is some help on the ghettocooler.net Treasure Trove.

The following code will work in Firefox and Safari, but will mysteriously have a problem in Internet Explorer:

<script language="javascript">
function submitLemon() {
   var swf = document.getElementById("myContent");
   swf.iCanHasParameter('lemon');
}

swfobject.embedSWF("movie.swf", "myContent", "800", 
                   "100%", "9.0.124", null, {}, {bgcolor: '#ffffff'});
</script>

It will however work if you replace the upper case letter with its lowercase equivalent:

<script language="javascript">
function submitLemon() {
   var swf = document.getElementById("mycontent");
   swf.iCanHasParameter('lemon');
}

swfobject.embedSWF("movie.swf", "mycontent", "800", 
                    "100%", "9.0.124", null, {}, {bgcolor: '#ffffff'});
</script>
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. All source code is released under a BSD License unless otherwise specified.

1 comment


August 1, 2010
me said:

http://labs.hellokeita.com/2007/10/16/swfobject-externalinterface-bug-on-ie/
I have not tried this. Here is another solution, http://www.cristalab.com/tips/como-comunicar-flash-y-javascript-en-actionscript-3-c50326l/

Your name

Email (optional, will not be shared)

Type the word "juice" (required to confuse the spammers)

Your comment


Add a comment