[SWFObject] restricting cleanupSWF to SWF only

David de Kock david at tnmedia.nl
Mon Sep 18 11:30:10 PDT 2006


In my application I'm mixing flash, wmv and qt player in the same page
and I've noticed that on unload the cleanupSWFs also cleans my WM and QT
objects. I've added one line to the cleanupSWFs function to check if the
object is Flash before cleaning up starts. I'm checking for the specific
flash classid value by the way.

Here is my version of the function:

deconcept.SWFObjectUtil.cleanupSWFs = function() {
  if (window.opera || !document.all) return;
    var objects = document.getElementsByTagName("OBJECT");
    for (var i=0; i < objects.length; i++) {
      if (objects[i].classid ==
"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000") {
        objects[i].style.display = 'none';
        for (var x in objects[i]) {
          if (typeof objects[i][x] == 'function') { 
          objects[i][x] = function(){};
        }
      }
    }
  }
} 

I wonder if checking for classid is the smartest? This should be unique
but I don't know if the classid values are likely to change when new
flash versions in the future.

Thanks,
David

PS. SWFObject rocks!

 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.4/449 - Release Date:
15-9-2006
 




More information about the Swfobject mailing list