So today I had some spare time, I noticed that I usually like to publish flash movies and add code to detect flash. However I noticed that in some cases there could be the slight chance that you do not have access to the HTML (a good example: flash games on facebook).
Flash provides properties that list out the client’s flash player, if they have sound, operating system and much more in their Capabilities class.
I wrote a simple script that can be called to check to see whether or not the client has the right flash player to view your file.
var currentFlashVersion:String = Capabilities.version;
var pattern:RegExp = /^(\w*) (\d*),(\d*),(\d*),(\d*)$/;
var result:Object = pattern.exec( currentFlashVersion );
var contentVersion:Number = 10; //Note if you want a different version of flash, change 10 to the version that you are looking for
if ( result[2] < contentVersion ) {
trace( “uh oh! you need to update flash” );
/*This would automatically open a page if the user’s flash player is older
*than the version that you requested earlier. If you want you can create
*a movie clip that would prompt the user, and you can place the code here.
*/
navigateToURL( new URLRequest( “http://www.adobe.com/products/flashplayer/” ), “_blank” );
}
I also wrote a class for this:
You would need to create a new instance of DetectFlash and call checkFlashPlayer() (a function) to check if you have the latest flash player. I also wrote a script that would print out the client’s capabilities.
link: www.josh-ho.com/blog/Files/FlashDetect-Class.zip
I also provided an example for users to take a look at
link: www.josh-ho.com/blog/Files/FlashDetect-Example.zip
Enjoy