danriegsecker / swfobject

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

Using javascript to obtain flash element -- behavior is changed in Firefox 3 #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
swfobject in FF3 breaks several standard methods of obtaining a pointer to
the  flash element. 

See http://thejaffes.org/test/main1.php for a demonstration of the issue.
In the demo, the first two buttons change the slideshow rate by using a
typical method of obtaining the flash element pointer. Those two buttons
work in IE and in FF2, but not in FF3. The second two buttons use the
swfobject method to obtain the flash element pointer and work in IE, FF2,
and FF3.

The following two standard methods for obtaining an instance of the flash
element work in IE and in FF2, but not in FF3. The first method is a
standard piece of generic javascript code. The second method utilizes the
YUI library.

var flashelement = (navigator.appName.indexOf("Microsoft") !=
-1)?window['flash1']:document['flash1'];

var flashelement = YAHOO.util.Dom.get('flash1') ;

The following method works in IE and in both FF2 and FF3.

var flashelement = swfobject.getObjectById('flash1');

Original issue reported on code.google.com by rsja...@gmail.com on 1 Jul 2008 at 5:11

GoogleCodeExporter commented 9 years ago
Thanks for the great test page. This is not a bug, the behavior is correct.

When using SWFObject static publishing browsers like IE, Opera and Safari use 
the
outer object element, while Firefox and other Mozilla browsers use the nested 
object.

The following:
var flashelement = (navigator.appName.indexOf("Microsoft") !=
-1)?window['flash1']:document['flash1'];
var flashelement = YAHOO.util.Dom.get('flash1') ;
var flashelement = document.getElementById("flash1");

all refer to the outer object, and will work in IE, Safari and Opera, but not in
Mozilla/Firefox, while:

var flashelement = swfobject.getObjectById('flash1');

is a method that uses a Flash specific feature test seeks on both the outer and 
a
possible nested object element to find the 'active' object (this is also why we
provided the method).

So please test the above 3 methods of referencing in Firefox 2 again, they 
shouldn't
work either.

Original comment by bobbyvandersluis on 1 Jul 2008 at 8:13