[SWFObject] javascript detection with swfobject

Geoff Stearns geoff at deconcept.com
Tue May 30 06:24:39 PDT 2006


in the latest version of swfobject, the write() method will return  
true or false depending on whether the flash content was written...

so you could do this:

if (!so.write('content')) {
	// flash was not written, do something
} else {
	// flash was written, do something else
}



On May 30, 2006, at 9:15 AM, Guillaume wrote:

> Hi,
>
> Ive been using swfobject, which is very handy - And i have been  
> asked to do some flash detection (for people coming with a Flash 7  
> player, to play Flash 8 swfs) - in Javascript, for various reasons  
> from my manager. Since when you put into SWFObject() the parameter  
> to write for a flash "8" swf, if someone (under IE or firefox) got  
> Flash Player 7, it will not write anything into the "Flashcontent"  
> div, here is my kind of solution , and at least compared to scripts  
> you can find here and there, this one looks to work well with ffox.
>
> <script>
> function returnobj(id) {
>   if (document.getElementById) {
>     return document.getElementById(id);
>   } else if (document.all) {
>     return document.all[id];
>   } else if (document.layers) {
>     return document.layers[id];
>   } else {
>     return false;
>   }
> }
>
> function didFlashWork()
> {
>
> var target = returnobj("Flashcontent");
>
> if(target) {
> if(target.innerHTML.length<2) {
>
>  target.innerHTML = "Sorry you do not have flash player/the good  
> version of flash player.. please see <a href='http:// 
> www.adobe.com'>Here</a> to dl a flash player..";
>
> }
>
> }
>
> }
>
> </script>
>
>
> (...)
>
> <html>
>
> <body>
>
> <script type="text/javascript" src="swfobject.js"></script>
>
> <div id="Flashcontent"></div>
> var so = new SWFObject("test.swf","mymovie", 200, 200, "8",  
> "#000000");
>
> so.write("Flashcontent");
> didFlashWork();
> </script>
>
>
>
>
>
>
> _______________________________________________
> SWFObject mailing list
> SWFObject at lists.deconcept.com
> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060530/52159928/attachment-0005.htm>


More information about the Swfobject mailing list