Aug
14

Detecting Flash Player 8 on a cfform

6 comments Posted by: Nahuel Foronda

Now that we are using some features of the flash player 8 such as file upload, we need detect whether the user has it installed in his/her computer. Macromedia has recently published an article on DevNet that explains how to implement a detection script and new feature called "Flash Player Express Install", which greatly simplifies the flash install. To be honest, I didn't read the article, but instead, I made a small script that checks for the flash 8 inside the cfform.

<cfsavecontent variable="checkVersion">
   var version = getVersion();
   var versionNumber = Number(version.substr(4,1));
   if(versionNumber < 8)
   {   
      //If the player is not version 8 or above, do something, such as showing an alert
      
      var msg = '<p>This example requires Flash Player 8 <font color="#0000ff"><a href="http://www.macromedia.com/software/flashplayer/public_beta/">You can download it here</a></font></p>'
      var alertSettings:Object = {title:'Warning', message: msg, width:200, headerHeight:27 }
      //remember that this way of showing an alert may break in future versions of CF, but it is the only way to embed html in it
      errorpopup = mx.managers.PopUpManager.createPopUp(this, FormErrorException, true, alertSettings);
      errorpopup.centerPopUp(this);
   }
</cfsavecontent>

You can call this script whenever you want, I updated our previous example so now it checks for the latest player

You can view the updated version

Download the updated code

Category: CFForm | ColdFusion |

6 Comments so far

Write yours
Geoff
I'm not completely familiar with the way cold fusion gets the version number from the browser/plugin, but you may want to be careful when using substring to check flash player versions.

Using this line: version.substr(4,1)

Once flash player gets above flash 9, that will fail to work.

You may want to try an alternate method, like &lt;a href=&quot;http://blog.deconcept.com/flashobject/&quot;&gt;FlashObject&lt;/a&gt;.
Todd
2. Todd wrote on August 26, 2005 at 10:45 AM
Just stumbled acrossed something that may work too...

Check this file out:

WEB-INF\cfform\flex-config.xml

About halfway down the page there is the following code:

&lt;flash-player&gt;
- &lt;!-- enable/disable player detection
--&gt;
&lt;enable&gt;true&lt;/enable&gt;
- &lt;!-- require 7.0.14
--&gt;
- &lt;!-- required player version
--&gt;
&lt;required-version&gt;7&lt;/required-version&gt;
- &lt;!-- 'dot' release of the required player
--&gt;
&lt;required-major-revision&gt;0&lt;/required-major-revision&gt;
- &lt;!-- minor revision number of the required player
--&gt;
&lt;required-minor-revision&gt;14&lt;/required-minor-revision&gt;
- &lt;!-- auto-install the player on windows and ie-only
--&gt;
- &lt;!--
When windows-auto-install is true, IE will attempt to download the ActiveX player without
user intervention. When false, the user is directed to the download url for upgrade.

--&gt;
&lt;windows-auto-install&gt;true&lt;/windows-auto-install&gt;
- &lt;!-- player upgrade page - users without the required Flash version will be directed here
--&gt;
&lt;download-url&gt;{context.root}/cfform-internal/detection-kit/upgrade_flash/upgrade_flash.html&lt;/download-url&gt;
&lt;download-https-url&gt;{context.root}/cfform-internal/secure/detection-kit/upgrade_flash/upgrade_flash.html&lt;/download-https-url&gt;
- &lt;!-- activex upgrade page - the location for downloading the ActiveX player
--&gt;
&lt;activex-download-url&gt;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab&lt;/activex-download-url&gt;
&lt;activex-download-https-url&gt;https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab&lt;/activex-download-https-url&gt;
- &lt;!-- plugin upgrade page - the location for downloading the Plugin version of the player
--&gt;
&lt;plugin-download-url&gt;http://www.macromedia.com/go/getflashplayer&lt;/plugin-download-url&gt;
&lt;plugin-download-https-url&gt;https://www.macromedia.com/go/getflashplayer&lt;/plugin-download-https-url&gt;
&lt;/flash-player&gt;

I'm thinking that changing this code to look for Flash 8 will work. I haven't tried it becuase I think Flash 8 is too buggy for my tastes. If anyone else gets this to work let me know.

buddhatech
Is there a way in in the form to hide a tab if flash 8 isn't installed? I would like to hide my accordian page all together if it is not installed/
Kurt Granroth
4. Kurt Granroth wrote on September 05, 2006 at 7:22 PM
the method of Detecting Flash Player 8 on a cfform seems a little complex to me, i don't know this command"var alertSettings:Object = {title:'Warning', message: msg, width:200, headerHeight:27 }"
Laura
Kurt,
That line of code has nothing to do with the actual plugin detection. It is only there to set some properties of the popup window.
lee
6. lee wrote on January 08, 2008 at 2:36 AM
Hi

I've an html file which is puplished in flash player 9..

If i test in few pc i am not able play the file.It gives me a black html with the image icon..(X) so i need "auto instilling script for flash player" can i use this script.. i don't have any idea on this ..

Leave your comment

Comments now closed. This means that probably, the technique or technology discussed here is outdated and by now, things have moved on.

It also means that we are not giving any kind of support for this.