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 following is an example that uses this API to show you what Flash
features your system supports:
The above list 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:
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!
Just a final word before we wrap up. If you have a question and/or want to be part of a friendly, collaborative community of over 220k other developers like yourself, post on the forums for a quick response!
Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 -
delivered weekly to over a bazillion subscribers!