SWFObject ExternalInterface bug on IE
I experienced a problem calling ExternalInterface.call when using SWFObject on IE.
Actually, I figured out that it wasn’t any bug. Just a little miss.
On IE, the Flash looks for the Flash Object by the Object’s ID.
So, what you need to do is just set the right name and id of the flash object you are embedding
[code lang="actionscript"]
swfobject.embedSWF("myflash.swf", "flash_content", "100%", "100%", "9.0.0", "expressInstall.swf", undefined, undefined, {id:"flashMovie", name: "flashMovie"});
[/code]
Just that!
I hope it helps someone that experienced the same problem.
Vaclav Vancura said,
February 29, 2008 @ 7:03 pm
You saved my day. Thanks! :]
David Higgins said,
April 4, 2008 @ 7:58 am
I’m having an issue with SWFObject and ExternalInterface.addCallback … I was browsing around and noticed that Mihai Bazon (http://mihai.bazon.net/blog/flash-s-externalinterface-and-ie) ran into a similar issue … just curious, as you didn’t mention this problem … if you know of a work-around to it?
In Firefox, my addCallback’s are registering just fine and my JS-code can execute my AS-code without issue … in IE, I get ‘object does not support this property or method’ errors — I’ve tracked it down to the __flash__addCallback(instance, name) method that appears to be dynamically injected into the browser by the flash plugin … problem is ‘instance’ has no ‘CallFunction’ method, and therefore can’t execute the “” XML ….
Any suggestions?
Og2t said,
June 25, 2008 @ 6:29 pm
Oh I so needed it over a year ago but couldn’t find a solution anywhere. Thanks a million!
Micah said,
August 6, 2008 @ 10:37 pm
I’m having the same problem as David Higgins. It is getting very frustrating. Does anyone know how to solve this problem? Also, all the swfobject.js files I’ve tried using (including v1.5.1) give me the javascript error: “n has no properties” in firefox. Any help would be greatly appreciated.
Ronny Karam said,
September 9, 2008 @ 6:47 pm
Hi,
Actually I’m having the same problem as David & Micah. I got to flash__ addCallback method and I’m sure it’s causing the problem yet there’s not working solution for it. Not adding an id to the object is not a problem, the problem is when you’re using externalInterface and actually add the id to the object, IE goes crazy and displays the error message: Object doesn’t support property or method.
Regards.
Adam Fisk said,
October 31, 2008 @ 2:48 pm
Same IE problem here. Are you guys all add the callbacks in the constructor? I’ll be experimenting tomorrow with a separate method that adds the callbacks — more likely my object will be in the DOM at that point. Would try it now, but it’s a little on the late side.
I’ll let you know if I find anything.
Adam Fisk said,
November 2, 2008 @ 10:23 am
The problem for me did have to do with the ID. I’m not sure what SWFObject is doing under the covers, but the following did not work for me:
var flashvars = {};
var params = {};
params.play = “true”;
params.loop = “false”;
params.quality = “high”;
params.allowscriptaccess = “always”;
var attributes = {};
attributes.id = “LittleShoot”;
attributes.name = “LittleShoot”;
attributes.align = “middle”;
swfobject.embedSWF(”LittleShoot.swf”, “littleShootNoFlash2″, “1″, “1″, “9.0.0″, “expressInstall.swf”, flashvars, params, attributes);
whereas this did:
var flashvars = {};
var params = {};
params.play = “true”;
params.loop = “false”;
params.quality = “high”;
params.allowscriptaccess = “always”;
var attributes = {};
attributes.id = “littleShootFlashContent”;
attributes.name = “LittleShoot”;
attributes.align = “middle”;
swfobject.embedSWF(”LittleShoot.swf”, “littleShootNoFlash2″, “1″, “1″, “9.0.0″, “expressInstall.swf”, flashvars, params, attributes);
Notice the attributes.id value. It looks like there may have been an issue with the flash object having the same name as the object id, something like that. Good luck.
Tim H said,
November 8, 2008 @ 8:18 am
I wrestled and cursed about this problem for a whole day.
Here is the official adobe solution:
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb400730
Check it out, they have 2 solutions, one didnt work for me, the other did work.
rouftop said,
February 14, 2009 @ 5:16 am
Tim H’s KB article was a lifesaver for me. I was having this same problem with ExternalInterface + Flash <= 9.0.45 on IE 6 & 7. One line of javascript and poof, problem solved.
vfleurima said,
March 27, 2009 @ 8:54 am
I ran into the same issues with Externalnterface + Flash 10 + IE 7 + SWFObject 1.5. The fix is to ensure that whatever DIV you end up calling SWFObject.write() on is already appended to the DOM.
vfleurima said,
March 27, 2009 @ 9:02 am
EDIT: A bit clearer.
I ran into similar issues using dynamically-generated elements with Externalnterface + Flash 10 + IE 7 + SWFObject 1.5. The fix for me was to ensure that whatever element I ended up calling SWFObject.write() on was previously appended to the DOM using appendChild() or somesuch.
Artem K. said,
April 8, 2009 @ 8:28 am
I battled this issue for days now. The problem: function names!!!!!
Check this site out:
http://blog.warptube.com/2008/12/2/oddities-with-externalinterface-and-ie
A really ugly issue with ExternalInterface can come up with naming your functions. You’re code will throw an error in code that looks something like:
function __flash__addCallback(instance, name) {
instance[name] = function () {
return eval(instance.CallFunction(”” +
__flash__argumentsToXML(arguments,0) + “”));
}
}
If you use: play, stop, tags, item, length, and likely some others I’m unaware of you will get an error inside Adobe’s JavaScript hook code. What’s happening is you inadvertently are screwing with some read only attributes of some IE functionality which is causing things to grind to a halt. My solution is to just prepend all my addCallback routines with an underscore.
Drew Horine said,
April 25, 2009 @ 3:10 am
That saved me a lot of frustration. Here’s how I used it for Dreamweaver’s standard AC_FL_RunContent code:
Add this at the end of your AC_FL_RunContent parameter list:
,’id’,'yourSWF’, ‘name’,'yourSWF’
Then add this to your object class parameters:
Of course, “yourSWF” is whatever you want to call the thing.
Now I’m calling javaScripts off the page (even with jQuery) in Firefox 3, IE7, Chrome, Safari (Win) and Safari (Mac).
Surreal Medias said,
July 10, 2009 @ 3:43 am
WOW thanks a bunch. The swfObject was my problem.
execution for pee wee said,
July 19, 2009 @ 8:18 am
nice! i’m gonna make my own journal
Confidant said,
September 1, 2010 @ 11:15 am
I was having a problem where ExternalInterface would break if the swf was cached in IE. Clearing the cache would always make it work again. My solution was to detect the browser, and if it was IE, to generate a timestamp before writing the swf to the browser window. So the URL would then be something like “/path/to/my/swfs/myfile.swf?timestamp=93932″ (number changes every time, forcing the browser to reload it).