There are a lot of times when you may want to know what version of the Flash Player plug-in your visitors are using. Or perhaps you want to know their screen resolution, operating system, language, whether they have accessibility or an IME. Finding all this out is simple thanks to the Flash Player’s flash.system.Capabilities class.
The following application will show how you can grab all the capabilities of the user’s Flash Player and display them in an easy-to-read DataGrid control.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
<mx:Script>
<![CDATA[
import flash.system.Capabilities;
/* Label function for the nameCol DataGridColumn object. */
private function nameColFunc(item:Object, column:DataGridColumn):String {
var ss:String = item.@serverString;
if (ss.length > 0) {
ss = " (" + ss + ")";
}
return item.@name + ss;
}
/* Label function for the valueCol DataGridColumn object. */
private function valueColFunc(item:Object, column:DataGridColumn):String {
return Capabilities[item.@name];
}
]]>
</mx:Script>
<mx:XML id="capabilitiesXML" source="capabilities.xml" />
<mx:ApplicationControlBar dock="true">
<mx:Label text="Player version: {Capabilities.version} (debug={Capabilities.isDebugger})" />
</mx:ApplicationControlBar>
<mx:DataGrid id="dataGrid" width="100%" height="100%" variableRowHeight="true">
<mx:dataProvider>{capabilitiesXML.property}</mx:dataProvider>
<mx:columns>
<mx:DataGridColumn id="nameCol" labelFunction="nameColFunc" headerText="Property name (server string):" />
<mx:DataGridColumn id="valueCol" labelFunction="valueColFunc" headerText="Value:" wordWrap="true" />
<!--mx:DataGridColumn id="valueCol" dataField="@value" headerText="Value:" wordWrap="true" /-->
</mx:columns>
</mx:DataGrid>
<mx:ApplicationControlBar>
<mx:Text width="500">
<mx:htmlText><b>Capabilities.serverString:</b>&llt;br />{Capabilities.serverString}</mx:htmlText>
</mx:Text>
</mx:ApplicationControlBar>
</mx:Application>
<capabilities>
<property name="avHardwareDisable" serverString="AVD" value="{Capabilities.avHardwareDisable}" />
<property name="hasAccessibility" serverString="ACC" value="{Capabilities.hasAccessibility}" />
<property name="hasAudio" serverString="A" value="{Capabilities.hasAudio}" />
<property name="hasAudioEncoder" serverString="AE" value="{Capabilities.hasAudioEncoder}" />
<property name="hasEmbeddedVideo" serverString="EV" value="{Capabilities.hasEmbeddedVideo}" />
<property name="hasIME" serverString="IME" value="{Capabilities.hasIME}" />
<property name="hasMP3" serverString="MP3" value="{Capabilities.hasMP3}" />
<property name="hasPrinting" serverString="PR" value="{Capabilities.hasPrinting}" />
<property name="hasScreenBroadcast" serverString="SB" value="{Capabilities.hasScreenBroadcast}" />
<property name="hasScreenPlayback" serverString="SP" value="{Capabilities.hasScreenPlayback}" />
<property name="hasStreamingAudio" serverString="SA" value="{Capabilities.hasStreamingAudio}" />
<property name="hasStreamingVideo" serverString="SV" value="{Capabilities.hasStreamingVideo}" />
<property name="hasTLS" serverString="TLS" value="{Capabilities.hasTLS}" />
<property name="hasVideoEncoder" serverString="VE" value="{Capabilities.hasVideoEncoder}" />
<property name="isDebugger" serverString="DEB" value="{Capabilities.isDebugger}" />
<property name="language" serverString="L" value="{Capabilities.language}" />
<property name="localFileReadDisable" serverString="LFD" value="{Capabilities.localFileReadDisable}" />
<property name="manufacturer" serverString="M" value="{Capabilities.manufacturer}" />
<property name="os" serverString="OS" value="{Capabilities.os}" />
<property name="pixelAspectRatio" serverString="AR" value="{Capabilities.pixelAspectRatio}" />
<property name="playerType" serverString="PT" value="{Capabilities.playerType}" />
<property name="screenColor" serverString="COL" value="{Capabilities.screenColor}" />
<property name="screenDPI" serverString="DP" value="{Capabilities.screenDPI}" />
<property name="screenResolutionX" serverString="R" value="{Capabilities.screenResolutionX}" />
<property name="screenResolutionY" serverString="R" value="{Capabilities.screenResolutionY}" />
<property name="serverString" serverString="" value="{Capabilities.serverString}" />
<property name="version" serverString="V" value="{Capabilities.version}" />
</capabilities>
View source is enabled in the following example.





For another example of checking a user’s system capabilities, check out this site’s “About you” page (view source is enabled, code is actually documented for once too).
How could the content of the textArea be shown on the printout covering the whole page???
properties like NONE,MATCH_WIDTH,FILL_PAGE and SHOW_ALL are useless,I can see the whole typed contents but it is not covering the whole page…