Returning an embed movie object

Returning an embed movie object

I have an object-embed combination for a flash swf file. I have added javascript controls for the movie.

I am successfully using the following in a function to access the movie and send the javascript commands:

  1. if (window.document[movieName])
  2.   {
  3.     return window.document[movieName];
  4.   }
  5.   if (navigator.appName.indexOf("Microsoft Internet")==-1)
  6.   {
  7.     if (document.embeds && document.embeds[movieName])
  8.       return document.embeds[movieName];
  9.   }
  10.   else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  11.   {
  12.     return document.getElementById(movieName);
  13.   }
I am trying to use jQuery to select the objects by determining if one of the flash properties exists. Something like:

  1. if ($("#"+movieName).TGetProperty("/",15) != "undefined") {
  2.          return $("#"+movieName).get(0);
  3.     } else if ($("#"+movieName).children("embed:first").TGetProperty("/",15) != "undefined") {
  4.         $("#"+movieName).children("embed:first").get(0);
  5.     }
$("#"+movieName) works for IE, but nothing I have tried can get the correct movie element out of the DOM to be the equivalent of document.embeds[movieName]. I have tried quite a few combinations beyond what is in the code above like:
  • $("#"+movieName).children("embed:first")
  • $("#"+movieName+"embed:first")
  • $("[name='"+movieName+"']")
Any idea what the correct method is would be greatly appreciated. I have it working but the problem bugs me.

Steven