Detect Flash Player Version | Actionscript based detection method (as2)

    looking for this in as3!? look no more Detect Flash Player Version | Actionscript based detection method (as3)

    Overview

    Recently I had a requirement that I had to detect which version of the flash player was currently installed. This is a normal thing, we do it all the time when embedding flash into html, we detect which version of the player is installed and if the user has an old version they are invited to upgrade…

    But what about finding the flash version from within flash? An actionscript based detection method? I hadn’t ever thought about doing that…

    It turns out it is very simple. From adobe I found the flash detection kit. Which had a lot of code I didn’t need. I only want to know what version of the player is running, not forward to upgrade sites and redirect… So I made this little testing file to save and share what I learned:

    Steps

    Internally flash knows it’s version number as $version. So to read it we must evaluate that variable.

    eval(“$version”);

    This returns a string, 3 letter operating system, a space, and then the version number as four numbers seperated with commas.
    I display the $version and to split it out I split the string on the space, and then split the version number with the comma delimiter and display them all.

    Example

    Here’s what mine is (gif):

    version detection actionscript gif

    And here’s what yours is (swf):

    Get Adobe Flash player

    Actionscript (as2)

    version = eval("$version");

    //The operating system: WIN, MAC, LNX
    var osType;
    //The player version.
    //The latest as of December '07: 9,0,115,0
    var majorVersion; //9
    var majorRevision; //0
    var minorVersion; //115
    var minorRevision; //0

    vers.text = version;

    osArray = version.split(' ');
    osType = osArray[0];

    versionArray = osArray[1].split(',');
    majorVersion = versionArray[0];
    majorRevision = versionArray[1];
    minorVersion = versionArray[2];
    minorRevision = versionArray[3];

    Download

    Here’s the source fla file: flash version detection actionscript method

    Let me know how and if you find this useful

    This entry was posted in tutorial and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

    6 Comments

    1. Damien
      Posted April 28, 2008 at 6:06 am | Permalink

      Just wanted to thank you for sharing. This one pulled me out a ditch today :)

    2. Fernando
      Posted August 1, 2008 at 4:41 pm | Permalink

      Beautiful, I was developing a game to be played at fullscreen mode. Since the flash Player 9 doesn´t allowed you to use keyboards, my game simple doesn´t work at all… :( Then I decided to install Player 10 (beta version) to make my game useful, and It worked fine, but since most users haven´t installed this version yet, I decided to write a code which detects the flash player version. If 10 or higher were detected the script will allow the fullscreen mode. If version below 10 was detected, the button disappear and not fullscreen mode were permitted to avoid the game not to be played correctly.
      I thought it was very simple to get this code work correctly, but I found that my code made the flash player to be unstable. I tried to get some help at adobe.com and there was a code similar to mine, which also crashes the flash player… and finally I decided to surf the web to find some code which helps me to finish my project… and I found yours, which works perfectly for my purpose.

      Thank you very much :)

    3. Paladin
      Posted September 4, 2008 at 11:12 pm | Permalink

      Thank you a lot,
      It’s very useful.
      Cheer.

    4. yuenyiupang
      Posted June 12, 2009 at 4:21 am | Permalink

      ithink better use Capabilities.version to trace the version
      however i wondering did anyone know how to detect the user pc has installed adoble AIR or not by using AS3

    5. Posted September 2, 2009 at 2:57 pm | Permalink

      There are cases where the OS isn’t 3 characters, such as on devices running Windows Mobile. Luckily your code is written to split on the space, not depend on a number of characters, so it’ll work fine in the case of “WINCE”.

    6. Posted September 2, 2009 at 3:20 pm | Permalink

    Post a Comment

    Your email is never published nor shared. Required fields are marked *

    *
    *

    You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    • Recent Posts

      WordPress updates plugin directory

      New additions to the plugin directory include: favorites, incorporating support forums into it's own tab for each plugin as well as support stats being displayed! Great! I think we also need the ability to give plugins ratings and reviews (bonus points if it can be done from within a wordpress admin dashboard when installing plugins). [...]

      Short Head

      Use zipf's short head to tune your website rather than redesign the whole thing. To make a website successful it needs to meet the needs of the users. Find out what those needs are by using the short head philosophy to equate most searched things as the biggest needs of the users. Use personas to [...]

      Img Set?

      Great article at a list apart discusing the state of the industry regarding responsive images. This picks apart the set attribute of the img element from a surprisingly objective view coming from someone so close to the picture element. Insightful discussion about the principle behind the proposals than the actual solution too. If the working [...]

      Triudo

      A mesmerizing animated triangle-ish shape form. Embedded Link triduo triduo Tweet

      Git – the paradigm shift

      A great developer story about the differences on what Git is vs other version control and what Git is not. This is how we should learn it. I heard over and over that it was distributed, but never grasped what that meant, so here are a few links and explanations that will help unlearn version [...]

      Tweening Lib comes to Javascript!

      I'm very excited to share the news that the tween library from GreenSock (hands down the best tweening library I used in flash) is not ported for use in javascript! This will be great! I missed that simple syntax from as3 when animating javascript, and now I can have my cake and eat it too. [...]

      Responsive CSS Tricks

      Here are a few useful css tricks to remember when building responsive design sites from web designer wall Embedded Link 5 Useful CSS Tricks for Responsive Design Making the design to be responsive is very easy as shown in my Responsive Design in 3 Steps tutorial, but maintaining the elements to look aesthetically balanced on [...]

      Picture element of srcset attribute?

      Bruce details the reasons and story behind the srcset attribute which is now introduced as an alternative to the picture element. Some aspects of the attribute are nice (like the fact that it's an attribute and not a new element, so it's creating up new elements with for problems. It's adapting currently used elements to [...]

      SVG Preloader with Raphael JS

      Here's a very creative use of using a newly available technology. Using svg graphics which are very lightweight, for a website preloader. I like the animation used as well. Embedded Link Make a stylish preloader with SVG | Tutorial | .net magazine Many sites neglect users with slow connections. Ian Culshaw explains how to use [...]

      CSS3 Button/Icon set

      I've been secretly hoping to see a few of these pop up once the whole icon font idea spread through the nets. I really like this idea and it's a very nice implementation too! I only see some quality issues on a couple of the icons (such as youtube), but it's awesome and I hope [...]

    • Recent Comments

      Bruce Brownlee

      Bruce Brownlee

      Ah IE6. I'd have 2 more years of sleep without IE6. Margin doubling, no properties,...
      versaena

      versaena

      how to give color at runtime…… thank you
      Mobile Websites

      Mobile Websites

      I disagree, mobile websites are the future – desktop websites and mobile websites...
      Matt Fasick

      Matt Fasick

      That's cool. I like the ripple effect as well.
      Nico

      Nico

      hi! really great job guy! very impressive.. just a question… do u have a solution to do a refresh...
      Evan Mullins

      Evan Mullins

      Agreed! I've just seen some people get pretty heated about separating all functionality...