ExternalInterface.addCallback – Object doesn’t support property or method
If your facing some EXTREMELY frustating JavaScript mesages in IE when trying to a utilise a call method from javascript into action script, maybe I can help. I’ve just spent 4 hours tearing my hair out about this problem and finally got it solved. It was so frustrating and all google searches were returning lots of unrelated information with alot of fixes but no ultimate solution (for my problem anyway).
So, to make sure that IE can use ExternalInterface:
- To get a reference to the flash movie, it shouldn’t be inside a form. If it must, in the case of .NET or Qcodo, use the solutions found at http://www.adobe.com/go/kb400730 OR use the swfobject.getObjectById function to get a reference.
- Update to the latest version of SWFObject (at time of writing this is 2.1) to place the flash in your page.
- The flash file must be visible on the page
I’ve placed the last point in bold as nowhere on the web was this a documented fix. I assume Internet Explorer might think this is “security” feature. I was displaying a modal window on top of the flash, which hid the flash from view as the flash can appear ontop of the modal window if the wmode parameter isn’t set to transparent.
The modal window needed to interact with the flash file, but couldn’t in IE because it was hidden.
6 Comments
Spent several hours trying to figure this out today – thought I’d add my new wisdom to your list:
1. Beware ActiveX reserved words, which will obviously only break IE. My problem was that I was registering a callback named ‘play’ – sure enough, a reserved word.
2. When debugging in IE7, be sure to clear the cache by going to tools>Delete Browsing History. Control F5 doesn’t clear the cache of old .swf files like in other browsers.
I had a similar issue:
In Firefox Addcallback worked like a charm – in i got the message like state in the title “Object doesn’t support property or method”
Searching the web i found many tips and solutions – neither one solved my problem.
My page is set up with a neat little Ajax calls using JQuery.
So there is the solution:
Instead of filling your page with something like
$('#content').html(ajaxResponse);
use the old-fashioned way:
document.getElementById('content').innerHTML = ajaxResponse;
So the whole request / output goes like this
$.ajax({
type: "GET",
url: "myflashplayerTemplate.html"
success: function(ajaxResponse){
document.getElementById('content').innerHTML = ajaxResponse;
}
});
I hope to save someone else’s time with this one
Thank you guys, I spent several days with this problem. With me occurred the same with Justin, i was using a reserved word ( “play”).
Thank you so much
Bless you, Marcel! You saved both my time and my hair!:) Thanks a lot
Great info! this is the exact issue I am having. After hours of frustration I narrowed it down to IE / Form. I have checked out provided link but cant implement fix. I’m hoping you may look at my code. Many Thanks Paul
Everything works until wrapped in form tags, and thought to use solution; window.[flash_movie_id] = document.forms[0].[flash_movie_id];
this is my code;
var flashVideoPlayer;
function _nsStop() {
var isIE = navigator.appName.indexOf(”Microsoft”) != -1;
flashVideoPlayer = (isIE) ? window['videoPlayer'] : document['videoPlayer'];
}
// Call the pauseResume() function within the SWF file.
function callFlashPlayPauseVideo() {
flashVideoPlayer.pauseResume();
}
Hello,
If the problem is the “addCallback” doen’t work after a “visibility=hidden”, replace “visibility=hidden” bye “width=0″.
Then it will work !
Good luck!