This is a discussion on Losing ExternalInterface callbacks in IE when flash is hidden within the Flash Actionscript Programming forums, part of the Web Development category; I'm having trouble with IE losing my ExternalInterface callbacks on a flash app when the swf is hidden. Has ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| I'm having trouble with IE losing my ExternalInterface callbacks on a flash app when the swf is hidden. Has anyone else had this problem? I'm using SWFObject to embed the swf. i don't think SWFObject is responsible for the error, but i thought someone here might know about this. Here's some more detail on exactly what's happening. I have a complex Flash application which uses SWFObject for embedding SWFs and uses External Interface for communication between the flash app and the DHTML it's embedded in. My SWF is embedded in an div tag and set the div tag visibility to false. Most of this is done in DHTML. There is an HTML link which change the div tag visibility to true which shows the flash swf, the div it's in. There is also a button in the swf which uses ExternalInterface to hide everything. Everything works fine in Firefox. In IE, when I click on the html link, everything operates fine. however, when i click on the close button in the swf app ( which executes the same javascript as the HTML link,) the hidden swf loses all the callbacks I've defined on it through ExternalInterface. So, when the "window" is reopened and the JS tries to initialize the flash app, I get a JS error saying object doesn't support this property or method. Here's some sample code that reflects what I'm trying to do. Code: function showDiv(divName) {
var objDivStyle = eval('document.all.' + divName + '.style');
objDivStyle.visibility = 'visible';
}
function hideDiv(divName) {
var objDivStyle = eval('document.all.' + divName + '.style');
objDivStyle.visibility = 'hidden';
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
function loadCatagory(param,iName){
showDiv('flashcontent');
thisMovie("gallery").LoadSelectedCategory(param,iName);
} Help please
__________________ A.Ramesh Failure is not the End…it is your stepping stone to success! |
| Sponsored Links |
| |||
| Hi, I don't have any expirience of this issue, but it sounds like it could be really hard to debug ![]() One solution I can think of is to use a combination of iframe and location connection. The idea would be to embed a small external interface "controller" swf via a small iframe on the page which will listen to events from HTML via external interface and forward them on to your flex app via local connection. Reverse wise localconnection from app > controller > HTML. I am pretty sure that local connection is unaffected by visibility of the div etc. Check 1st that it is not a swfObject issue by mocking up your page with the standard <object> / <embed> method. If it is still broken , then try the above. Let me know how you go...
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
| |||
| from what i've read on other people's blogs (sorry, no link to give), this is a Flash issue, not a SWFObject issue. it may be be related directly to using the 'display' attribute. possible workarounds i've heard of are to not use 'display' attribute in CSS, but to either minimize the div using the 'width' attribute (width: 0) or reposition it off-screen somewhere. i haven't tried any of this myself, so i don't know what works and what doesn't.
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
| |||
| Thanks for the replies. Aran - Using LocalConnection and a controller SWF is an interesting idea. I'd prefer not to go with that solution only because our particular architecture is going to make doing that fairly complex, but it seems like something that might work well. If all else fails, I may have to go with that. i appreciate the idea. Philip - I think that's exactly correct. I'd thought about doing what you suggest and was hoping there was a bit of a cleaner way of doing it. But your sample works for me in Firefox and IE7. I may be able to tweak it a little to make it work in IE6. That's probably what i'll start with.
__________________ A.Ramesh Failure is not the End…it is your stepping stone to success! |
| |||
| I think I figured out a work-around for this. Create a regular button on the HTML page that contains the Flash SWF that you are hiding. Then, when hiding the SWF from inside the SWF, make an ExternalInterface call to a javascipt function that sets focus to that button and then clicks it. It worked for me.
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
| |||
| Actually, for me the problem occurs at the point where the SWF is hidden using an ExternalInterface call that hides a div or iframe that contains the SWF. I played around with it quite a bit and I scripted the HTML button click without setting focus and it didn't work. I even tried using timers, thinking it might be a timing thing. Then the thought occurred to me that it might be a focus thing. So, I tried scripting setting focus to the button and then clicking it, and it worked. After I show the iframe again, I can still call my ExternalInterface callbacks from javascript.
__________________ The OXYGEN Delivers edgy, intelligent Technology to all... |
| |||
| I'm not sure if I answered you directly Aran, but just to make sure, I thought that I would add that the original issue at the top of this thread is the same issue that I was having. The problem IS NOT that you can't call ExternalInterface callbacks from javascript when the SWF is hidden (although that is also true). The problem IS that after showing the SWF again, the ExternalInterface callbacks are gone. Oh, and by the way, the visibility of the SWF does affect LocalConnection calls (at least in IE6). I tried many, many different ways of working around the problem and the LocalConnection approach was one of the things that I tried. The LocalConnection approach did resolve one level of issues that I was having with hiding and showing divs/iframes that contain SWFs with ExternalInterface callbacks, but I eventually ran into the same problem again in a different place. The solution that I mentioned above ended up being the best option for resolving all of my issues.
__________________ A.Ramesh Failure is not the End…it is your stepping stone to success! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 101 Tips for Losing your weight | prasannavigneshr | The Lounge | 104 | 02-03-2008 09:16 PM |
| 101 Tips for Losing your weight | prasannavigneshr | The Lounge | 0 | 12-23-2007 09:08 PM |
| What is Hidden Text? | H2o | Search Engine Optimization | 2 | 12-19-2007 03:15 PM |
| Domains losing their original purpose | oyu2o | General Web hosting Discussions | 1 | 04-26-2007 11:12 PM |
| Losing all that fat | oyu2o | The Lounge | 4 | 03-15-2007 09:05 AM |