开发者

How to customise "old version" SWF output, with swfobject 2.1?

I've been using swfobject for a recent project, and its great. But now that I've managed to get FlashSwitcher up and running in Firefox I notice that when I'm running Flash Player 7 the info displayed when I am running a version lower than I've specified has been customised (in this case by the Moodle page the the swfobject embed code sits in). Attached is a screenshot of that output SWF, as generated by Moodle. I can confirm that some of my users also see this, so my FlashSwitcher is functioning correctly.

Most of my use cases are outside of the Moodle context, they're standalone, what I'm after is exactly how they customised it, how I can change their customisation, and how I can do the same when the swfobject detection is standalone.

Please note that enforcing the 开发者_Go百科user to upgrade their Flash Player plugin via ExpressInstall has been frowned upon by the client, they want suggestive actions and a link - but no auto installs or similar.

My implementation uses the 'twice cooked' method as I have an accessibility requirement to show non-Flash content should a user have neither Flash, Javascript or both. Here's my embed method call, which executes when a YUI2 document load event fires:

swfobject.embedSWF("../../swf/video-loader.swf", "flash_object_a", "877", "400", "8.0");

Ultimately I want to customise this "old version" output to be something I've created/written.

How to customise "old version" SWF output, with swfobject 2.1?

cheers, d


You can use swfobject's getFlashPlayerVersion method (explained here) to check for Flash Player version and take appropriate action.

A simple example would be:

var has_version_8_or_greater = swfobject.hasFlashPlayerVersion("8");

if(has_version_8_or_greater){
   //embed SWF using SWFObject
} else {
   //Check to see whether an older version of Flash is found.
   var version = swfobject.getFlashPlayerVersion();
   if(version.major > 0){
      //You have Flash but it's too old.
      var version_str = version.major + "." + version.minor + "." + version.release;
      alert("You have Flash Player version " + version_str + ". Please update!");
   } else {
      //You don't have Flash.
   }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜