Archive
This is an archived tutorial about Flash. It's kept for history and may reference outdated tech.
TL;DR
Not every device supports every Flash feature, like a webcam on a device without one. The flash.system.Capabilities API lets you check what's supported and read system details such as the CPU, OS, and Flash Player version, so you can handle missing features gracefully and tell users why something won't work.
- The example checks properties like Capabilities.hasAudio, Capabilities.hasAccessibility, and Capabilities.hasEmbeddedVideo once it's added to the stage.
- A helper, SetEnabledOrDisabled, takes each Boolean and calls gotoAndStop(1) or gotoAndStop(2) on a movie clip to show yes or no.
- The article doesn't describe each function; it points you to Adobe's documentation and the downloadable source code for CS5.5 and CS4.
The Flash Player does a good job of allowing you to focus on creating cool content that works on a wide range of devices. Despite that, there are a handful of Flash features that not all devices support. An example of this is using the webcam on a device that doesn't actually have a webcam.
To help you gracefully handle situations where what you expect and what the device your content will be viewed on supports are not the same, you have the flash.system.Capabilities API.
The original example used a Flash movie to show what Flash features your system supports. Since modern browsers no longer run Flash content directly, the source code and the relevant ActionScript are included below instead.
The example uses almost all of the functions found in the Capabilities API to return whether a feature is supported or provide information on system settings such as the CPU, OS, Flash Player version, etc.
You can download the source code (Flash CS5.5 and CS4) for the above project or just glance at the various functions starting with Capabilities I used below:
public function WhatToSupport() {
// constructor code
this.addEventListener(Event.ADDED_TO_STAGE, DetermineCapabilities);
}
private function DetermineCapabilities(e:Event) {
SetEnabledOrDisabled(Capabilities.avHardwareDisable, cameraMicrophone);
SetEnabledOrDisabled(Capabilities.hasAccessibility, accessibility);
SetEnabledOrDisabled(Capabilities.hasAudio, audioPlayback);
SetEnabledOrDisabled(Capabilities.hasAudioEncoder, encodingAudio);
SetEnabledOrDisabled(Capabilities.hasEmbeddedVideo, embeddedVideo);
SetEnabledOrDisabled(Capabilities.hasIME, imeInstalled);
SetEnabledOrDisabled(Capabilities.hasMP3, mp3decoder);
SetEnabledOrDisabled(Capabilities.hasPrinting, printing);
SetEnabledOrDisabled(Capabilities.hasScreenBroadcast, screenbroadcast);
SetEnabledOrDisabled(Capabilities.hasScreenPlayback, screenplayback);
SetEnabledOrDisabled(Capabilities.hasStreamingAudio, streamingAudio);
SetEnabledOrDisabled(Capabilities.hasStreamingVideo, streamingVideo);
SetEnabledOrDisabled(Capabilities.hasTLS, sslSockets);
SetEnabledOrDisabled(Capabilities.hasVideoEncoder, encodingVideo);
SetEnabledOrDisabled(Capabilities.isDebugger, debugVersion);
SetEnabledOrDisabled(Capabilities.isEmbeddedInAcrobat, embeddedPDF);
SetEnabledOrDisabled(Capabilities.localFileReadDisable, hardDrive);
SetEnabledOrDisabled(Capabilities.supports32BitProcesses, thirtyTwoBit);
SetEnabledOrDisabled(Capabilities.supports64BitProcesses, sixtyFourBit);
touchScreen.text = Capabilities.touchscreenType;
flashVersion.text = Capabilities.version;
cpu.text = Capabilities.cpuArchitecture;
language.text = Capabilities.language;
manufacturer.text = Capabilities.manufacturer;
h264idc.text = Capabilities.maxLevelIDC;
osValue.text = Capabilities.os;
pixelaspectratio.text = Capabilities.pixelAspectRatio.toString();
runtimeEnvironment.text = Capabilities.playerType;
screenColor.text = Capabilities.screenColor;
screenDPI.text = Capabilities.screenDPI.toString();
horizontalResolution.text = Capabilities.screenResolutionX.toString();
verticalResolution.text = Capabilities.screenResolutionY.toString();
}
private function SetEnabledOrDisabled(supported:Boolean,
yesOrNoInstance:MovieClip) {
if (supported) {
yesOrNoInstance.gotoAndStop(1);
} else {
yesOrNoInstance.gotoAndStop(2);
}
}
I am not going to describe the various functions in this article, for Adobe's documentation on this is fantastic. Just read the documentation and refer to the source code and example you see in this page for some guidance to see how it is used.
Conclusion
There you have it: an introduction to the easy-to-use Capabilities API via a sample project and Adobe's documentation. If you are ever using a feature whose existence is dependent on the device your content will be viewed on, strongly consider checking to see if the feature exists and giving users some notice about why your content won't work as expected for them!
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, Parallax, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

