rss twitter

Check Flash Player Version


Just a quick snippet to determine the visitor's Flash Player Version (incl. OS and Version RC) in Actionscript 3. The detailed trace of all information covers Operating System, Major Flash Version and up to the 4th release version, e.g. 10.0.42.34 - the latest release yet.

You can easily copy and paste the following code and then check for the required version. FDT users can download and import the following Template: flashVersion.xml (use it with flashVersion)

Actionscript 3 snippet:

Actionscript:
  1. // get & split information arrays
  2. var _fullInfo:String = Capabilities.version;
  3. var _osSplitArr:Array = _fullInfo.split(' ');
  4. var _versionSplitArr:Array = _osSplitArr[1].split(',');
  5.  
  6. // declare the relevant infos
  7. var _osInfo:String = _osSplitArr[0];
  8. var _versionInfo:Number = _versionSplitArr[0];
  9.  
  10. // quick check
  11. trace("major version you're using: " + _versionInfo);
  12. trace("you're using the following OS: " + _osInfo);



Same check in JavaScript (MooTools):
Fabian (from www.fabian-beiner.de, @fabianbeiner) just send in a MooTools check for Flash Player version as well and for sure we'll publish it - thanks, hunny! You can directly use it in your HTML script tags when using MooTools already. But be sure to tell Flash then what's up :) Going to publish an article about JS-AS connection soon.

JavaScript:
  1. switch (Browser.Platform.name) {
  2.   case 'mac':
  3.     var platformName = 'Mac';
  4.     break;
  5.   case 'win':
  6.     var platformName = 'Windows';
  7.     break;
  8.   case 'linux':
  9.     var platformName = 'Linux';
  10.     break;
  11.   case 'ipod':
  12.     var platformName = 'iPod touch/iPhone';
  13.     break;
  14.   case 'other':
  15.   default:
  16.     var platformName = 'some really weird platform, dude';
  17.     break;
  18. }
  19.  
  20. var flashVersion = Browser.Plugins.Flash.version || false;
  21.  
  22. document.write("You're using " + platformName + ".<br>");
  23. if (flashVersion) {
  24.     document.write('And you got Flash ' + flashVersion + ' installed.');
  25. } else {
  26.     document.write("You don't have Flash installed")
  27. }

5 Responses to “Check Flash Player Version”

  1. ravi j. says:

    hello, good snippet. but can you help me quick? i want to play different movieclips on different versions. i mean playing mc1 when version is 9 and mc2 when 10.

    thanks!!
    ravi

  2. Marvin Blase says:

    hey,
    for sure - just ask for the version in an if-conditional. e.g.

    if(_versionInfo == 10) {
    mc1.visible = true;
    mc2.visible = false;

    mc1.gotoAndPlay(1);
    } else {
    mc2.visible = true;
    mc1.visible = false;

    mc2.gotoAndPlay(1);
    }

    don't forget the stop(); in the first frame of your different movieclips.

  3. samBrown says:

    thanks for the snippet, very useful. I was trying to figure this out the other day and this implementation is much more elegant. Thank you!

  4. Navid says:

    I want to check the version and after checking if the player is under version 10, the flash run a.exe appilication that contains flash player V10 ...
    what should I do ?

  5. Anonymous says:

    Neat, except that your demo snippet doesn't show up on Flash Player 8 and below because there is no such thing as Actionscript 3 there. So frankly I don't even get what is that Compatibility class for?

Leave a Reply

Powered by WordPress | Free T-Mobile Phones for Sale | Thanks to Palm Pre Blog, Video Game Music and Get Six Pack Abs