getElementById is killing me

So, I was telling a number of up to 10 Flash-Apps to do some stuff using JS. I was using this code:


for(var i = 1; i <= 10; i++) {
      if(document.getElementById("swf" + i)) {
          try { document.getElementById("swf" + i).sendToActionScript("stop"); }
          catch(e) { }
      }
}

And it worked perfectly in Firefox. IE though? Blinking cursors (switching between the hand-version and the normal one) and flash didn’t receive any orders either.

So I used the version mentioned in the Adobe help files, which was this function:


function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[movieName];
         } else {
             return document[movieName];
         }
}

And changed the existing code accordingly to:


for(var i = 1; i <= 10; i++) {
      if(thisMovie("swf" + i)) {
          try { thisMovie("swf" + i).sendToActionScript("stop"); }
          catch(e) { }
      }
}

It still works in Firefox, but the same bugs in IE. The stupid cursor flickers and it’s unable to locate the SWF-files which Firefox can find easily.

I first gave the SWF-elements just an id with the correct name, then also tried it with both name and id. But the IE refuses to find them.

I wasted so much time on this… anyone can help me please? Why doesn’t this wooooooooooooooork I don’t know. :wt: