ouyang789987 / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

SWFObject not accessible in Firefox, unless defined #416

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Embed SWBOject on the page as, 

swfobject.embedSWF("player.swf", "player", "100%", "314",
"9.0.0","expressInstall.swf", flashvars, params, attributes);
player.swf has some JS functions defined through ExternalInterface

2. The following call works in IE and Chrome fine, but not in Firefox, it
says "player" is not defined

player.setClipID("flv_d532a93a-61bb-4325-a3d0-f7e2a4c03e3c");

3. Works in Firefox only if I declare the player variable, and assign it
the element with id "player",

var player = document.getElementById("player");
player.setClipID("flv_d532a93a-61bb-4325-a3d0-f7e2a4c03e3c");

Not sure how IE and Chrome are able to access the player object, even if
it's not defined?

What is the expected output? What do you see instead?
"player" object not defined/available

What version of the product are you using? On what operating system?
Win XP SP3, Firefox 2,3 or 3.5

Please provide any additional information below.

Original issue reported on code.google.com by nagarajh...@gmail.com on 17 Dec 2009 at 7:06

GoogleCodeExporter commented 9 years ago
I don't see how this is a swfobject bug.

The timing of access to DOM elements are controlled by the browsers.

If you want a standard way of storing the reference, then add a callback 
function to 
embedSWF() or registerObject() as per the docs.

e.g.
<script type="text/javascript"> 
  var myFlashObj;
  function getRef(e) {
  if (e.success)
    myFlashObj = e.ref;
  }
  swfobject.registerObject("myId", "9.0.0", "expressInstall.swf", getRef);
</script> 

Original comment by aran.rhee@gmail.com on 18 Dec 2009 at 12:20