Skip to Navigation

More IE Madness & Object Swap Goes OOP

A couple of days ago, having just installed a new version of the Flash player in Internet Explorer, I tested recent updates to an ongoing Flash project. Imagine my amazement when, instead of an interactive Flash exhibition, I got a notice that my Flash version was not up to date. Thinking that maybe something went wrong with the recent installation, I went to the Adobe website and reinstalled. Still, no luck.
ObjectSwap has a nifty param line for version checking, and in this project it looks like this:

<param name="flashVersion" value="8" />

The current flash version in my browser is: 9,0,115,0, and up until now, the version checking code worked in such a way that if the version declared in the param is lower than or equal to the installed version, the Flash content will be displayed, and otherwise you get the alternate content – in this case, a request to download the latest player. After playing around with it, I saw that either I had to change the version to 9 in the param, or remove it altogether. In other words, all of a sudden, IE requires the exact flash version of the player, rather than the version of the movie. Madness…

The workaround for that, was to include an iteration of version checking in the script – first, you check for the movie’s version, as defined in the param, if that fails, you increase the version three times, until you either get a success, or all four attempts fail.

} else if ( && typeof (ActiveXObject) == "function"){
   //IE flash detection.
   //Try 3 versions higher than specified
   var maxCount = Number(version) + 3;
   for(var i=version; i<=maxCount; i++){
         var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
         return true;
  return false;

Unfortunately, this is not one hundred percent future proof. If you’re publishing for 8, you might want to keep an eye on it after version 11. Unless, of course, IE recognises it as a bug and fixes it for later updates. Shall we all have a breath-holding competition?

In the meantime, this fix seems to work for IE7 and amazingly didn’t break in IE6 when I was showing the aforementioned project on a client’s PC. Miracles do happen.

Ok, so this is the bugfix issue. The second subject of this conversation, is the complete redesign of the ObjectSwap script, so it now uses objects, prototype functions, namespaces, and general best practices of OOP. Perhaps even more importantly, it now uses DOM event listeners instead of window.onload event.

The new code was written in July, and together with the latest bug fix, I feel it’s about time to release the update.

So here it is: ObjectSwap Update

2 responses to “More IE Madness & Object Swap Goes OOP

  1. Have you noticed any problems with ObjectSwap interfering with Flash pre-loaders in IE? I’m using the older version (pre-OOP) and have noticed that the pre-loaders in Flash movies don’t run when I add ObjectSwap to the mix. What I see instead is a system icon (like the broken image icon) in the place of the Flash movie, where I would normally see the pre-loader. Of course I’d rather not have that icon — any thoughts on that?

  2. Hi Carol,

    I just integrated ObjectSwap into a new Flash project, that has a preloader swf which loads the main content into itself.

    I am using the latest OOP version, so maybe you could give it a try. One of the main differences is that it’s not using window.onLoad but DOM event listeners, which means it fires-up quicker instead of waiting for the whole page to load.

    Or if you’re using a different type of preloader, there could be some unknown conflict, and then you might need a different solution – but try the DOM version first and let me know what happens.


Leave a Reply

Your email address will not be published. Required fields are marked *