[SWFObject] SUMMARY: Ongoing 'disspearing swfs'/'out of memory' errors issues

Geoff Stearns geoff at deconcept.com
Wed Aug 2 10:30:02 PDT 2006


here's a quick summary and a temporary fix for you all:

Currently when you have a link on a page that uses  
href="javacript:..." it triggers the onbeforeunload event in IE. This  
is bad because in 1.4.3 I use the onbeforeunload event to remove some  
code that Flash Player 9 inserts into the page to clean up swfs (this  
is because of a bug in IE that causes streaming swf files to keep  
playing even after you navigate away from the page - basically IE  
sucks ass)

Unfortunately, the code that Flash Player 9 inserts doesn't work so  
well when you have more than one swf on the page - you get an "Out of  
memory" error at line 56 when you leave the page. I have a very  
similar function that does not cause the out of memory error that I  
was using to replace the 'bad' function.

Since I was using onbeforeunload to clear out the 'bad' function, you  
can see how the above two issues cause problems, and this is why the  
swfs are dissapearing.

We did find a fix that we are using with the NBC universal video  
player, which i'll share with you all who need temporary fixes.

you can just place this function anywhere in your js or on the page  
and it will take care of things for you. Just be warned that if you  
already have an onunload event, this will delete it, so you'll have  
to work around that on your own until I can come up with a cleaner  
solution.


window.onbeforeunload = function() {
	__flash_unloadHandler = function(){};
	__flash_savedUnloadHandler = function(){};
	window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
}

using this in conjunction with SWFObject 1.4.2 (and maybe 1.4.3)  
should be fine. You can get older swfobject versions from the SVN  
repository here:

http://svn.deconcept.com/swfobject/tags/

Let me know if anyone has some ideas on a clean way to fix this, or  
any other questions about it.



On Aug 2, 2006, at 1:48 PM, geoff.+.nwo at neverbox.com wrote:

>
> I use multiple SWF files on the same page AND they use flashvars (i.e.
> they're clickable).
>
> On unloading the page, the entire browser gets stuck with a random  
> error
> (sometimes an official error, sometimes it just closes, sometimes  
> it gets
> stuck and requires ctrl+alt+del).
>
> Many people have tried it and it happens with IE, XP SP2 and every  
> flash
> version since at least 6 (those files are made in v6).
>
> It was fixed as soon as I removed this function:
> for(var x in _2d[i]){
> if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}
>
> Only then I found out another annoying (yet harmless) problem -  
> when you
> click any of the files, each and every SWF file in the page  
> dissapears (of
> course, seconds later you're taken to another page, but still...).
> To fix this, I've deleted
> _2d[i].style.display="none";
>
> Or in other words, the entire loop of for(var i=0;i<_2d.length;i++){
>
> Geoff told me those functions have something to do with streaming  
> content and
> I can safely remove them, but I'm trying to convince him that this  
> problem
> affects everyone who uses multiple SWF files on the same page and  
> they're
> clickable.
> _______________________________________________
> SWFObject mailing list
> SWFObject at lists.deconcept.com
> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com




More information about the Swfobject mailing list