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:
-
// get & split information arrays
-
var _fullInfo:String = Capabilities.version;
-
var _osSplitArr:Array = _fullInfo.split(' ');
-
var _versionSplitArr:Array = _osSplitArr[1].split(',');
-
-
// declare the relevant infos
-
var _osInfo:String = _osSplitArr[0];
-
var _versionInfo:Number = _versionSplitArr[0];
-
-
// quick check
-
trace("major version you're using: " + _versionInfo);
-
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:
-
switch (Browser.Platform.name) {
-
case 'mac':
-
var platformName = 'Mac';
-
break;
-
case 'win':
-
var platformName = 'Windows';
-
break;
-
case 'linux':
-
var platformName = 'Linux';
-
break;
-
case 'ipod':
-
var platformName = 'iPod touch/iPhone';
-
break;
-
case 'other':
-
default:
-
var platformName = 'some really weird platform, dude';
-
break;
-
}
-
-
var flashVersion = Browser.Plugins.Flash.version || false;
-
-
document.write("You're using " + platformName + ".<br>");
-
if (flashVersion) {
-
document.write('And you got Flash ' + flashVersion + ' installed.');
-
} else {
-
document.write("You don't have Flash installed");
-
}



February 13th, 2010
Marvin Blase
Posted in
Tags:
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
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.
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!
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 ?
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?