1

Does anybody happen to know how to detect the flash BUILD version?

Please notice it's not a duplicate. I am not asking about the player version, but about the build version. meaning the last 3 digits. That is, if it's 18.0.0.203 - then I want the "203".

Thanks!

akmozo
  • 9,829
  • 3
  • 28
  • 44
Yogev Hadad
  • 123
  • 8

3 Answers3

2

The flash.system.Capabilities.version gives you what you need ( the internal build number ) :

Specifies the Flash Player or Adobe® AIR® platform and version information. The format of the version number is: platform majorVersion,minorVersion,buildNumber,internalBuildNumber.

var internal_build_number:int = flash.system.Capabilities.version.split(',')[3];
// gives : 203, for flash player 18.0.0.203

EDIT :

To get the exact version of Flash Player using JavaScript, you can use an flash.external.ExternalInterface (how to use it here) to send the information from Flash to JS.

For that, if you are an ActionScript programmer ( otherwise you can download the swf (1.24KB) from here ) so you can write something like this :

ActionScript 3 :

// fn : the name of the js function which will get the flash version
//      this name is passed by flash vars
var fn:String = this.loaderInfo.parameters.fn || 'console.log',
    // WIN 18,0,0,203 => [18,0,0,203]
    version:Array = Capabilities.version.split(' ')[1].split(',');  

if(ExternalInterface.available){
    // call the js function and pass to it the flash player version
    ExternalInterface.call(fn, version);
}

Then for the HTML part :

JS :

function echo(version){  
    // for : version = [18,0,0,203] 
    // gives : internal build number : 203
    console.log('internal build number : ' + version[3]);  
}

HTML :

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
    <param name="movie" value="flash_to_js.swf" />
    <param name="flashvars" value="fn=echo" />
    <object type="application/x-shockwave-flash" data="flash_to_js.swf">
        <param name="flashvars" value="fn=echo" />
    </object>
</object>

Hope that can help.

akmozo
  • 9,829
  • 3
  • 28
  • 44
0

It seems that the same question posted to Adobe forums just today.

    function showFlashBuildNumber(){
        var a = navigator.plugins;
        var dllfname;

        if (0 < a.length) {
           for (var d = "", b = 0, g = a.length; b < g; b++) if (-1 != a[b].name.toLowerCase().indexOf("flash")) {
           dllfname = a[b].filename;
          }
        }
         
        var parts = dllfname.replace(".dll", "").split("_");
        var buildnumber = parseInt(parts[4]);

        console.log(buildnumber);
    }

It worked on Win7&IE11 and Firefox39.
Not working on Chrome. Probably caused by built-in player...

If you want to get build number not at JS side but flash, it can get by using Capabilities.version and trim it. (that's akmozo's answer)

Community
  • 1
  • 1
Yasuyuki Uno
  • 2,417
  • 3
  • 18
  • 22
  • @YogevHadad You can use [`ExternalInterface`](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html) to communicate between flash and js, I edited my answer to show you an example, take a look. – akmozo Jul 15 '15 at 18:15
  • @akmozo I think he doesn't want communicate between flash if possible. Maybe his purpose is... detect the vulnerable versions of flash player before loading swf (or advertisement) and urge to update latest version. – Yasuyuki Uno Jul 16 '15 at 02:14
0

flashversionchecker.swf:

import flash.display.*;
import flash.external.*;
import flash.system.*;

public class fver extends Sprite {

    public function fver():void{
        super();
        do  {
        } while (ExternalInterface.available == false);
        try {
            flash_version_js();
        } catch(err:SecurityError) {
        } catch(err:Error) {
        };
    }
    public function flash_version_js():void{
        var flashPlayerVersion:String = Capabilities.version;
        var osArray:Array = flashPlayerVersion.split(" ");
        ExternalInterface.call("as_flashver", osArray[1]);
    }

}

HTML and javascript:

<script type="text/javascript" src="swfobject.2.2.js"></script>
<div style="visibility:hidden; display:inline;" id="flashdiv"></div>
<script type="text/javascript">  
        swfobject.embedSWF("flashversionchecker.swf", "flashdiv", "1", "1", "9.0.0");


            function frmt(sTT, z, s1) {
                var i = 3-z.length;
                sTT = sTT + z;
                while (i-->0) sTT=sTT+"&nbsp;";
                sTT = sTT + s1;
                return sTT;
            }
            var flash_version = "";
            function as_flashver(v) {
                var z = v.split(",");
                flash_version = z[0] + "." + z[1] + "." + z[2] + "." + z[3];


                console.log("Flash version (Full):" + flash_version);
                console.log("Build Flash version:" + z[3]);

        </script>  
Drakon
  • 11
  • 2