Using Mobile Device Capabilities in Flash Lite

Using Device Capabilities

It’s important to consider which environment your mobile device application will run in, since not all devices running Flash Lite will have the exact same features. If you remember, the Sony Ericsson Aino and the Nokia E71 have different ways for users to interact with software applications. The E71 has a QWERTY keypad, similar to the one found on most laptops and PCs, making it easier to write an email, for example. The Aino has both Touch UI and traditional mobile keypad capabilities, allowing a user to choose between Touch UI, by pressing the screen of the device, or using the keys for navigation. Later you’ll cover using keys and touch interaction.

In this section you will learn about the System.capabilities class, which can be used for accessing more information about your application’s environment.


Use the System.capabilities object to determine the capabilities of a device running the Flash Lite player. This class has numerous static read-only properties that can provide you with the data to help you adapt your application to the targeted system, based on the values retrieved by System.capabilities.

Consider the need to build an application that requires playing an MP3 or Video, or an application that needs to send MMS. Only, you find that the device doesn’t have the facility to playback the media in the way you need and the device is only able to send SMS. “Duh!”

The System.capabilities properties can be grouped into the following categories:

  • Information about the system

  • External data support

  • Key and device interaction

  • Media capabilities

  • Communication features

You’ll take a look at each one of these in turn next. There are also files accompanying each section, which you can run to view each of the properties listed.

Information about the System

You can use the system details in an application to specify information about the device’s hardware and software. Three properties of the System.capabilities object in particular can provide this:

  • System.capabilities.os—Returns the operating system

  • System.capabilities.version—Returns the Flash Lite player version

  • System.capabilities.language—Returns the device’s language

You can use these properties for various scenarios. For instance, knowing about a device’s default language in the application could provide a useful aid. In the event that the end user changes the default language on the device, the application could adapt to this automatically, by detecting the language property.

If you run the chapter3_SystemInfoSupport.fla file, you will see each of the system information details supported by a device in Device Central. The code in the .fla file simply contains an Input text field set on the stage, with its “variable” setting set to capabilities. You’ll find that, on the first frame of the Timeline, the AS sets the movie to “FullScreen” and then assigns each of the properties listed to the capabilities variable (see Listing 3-18). The code (which you can download from is similar for the subsequent sections on System.capabilities.

Listing 3-18: The System.capabilities object properties for System Information

fscommand2("FullScreen", true);


capabilities = "SYSTEM INFORMATION: " + newline + newline;


capabilities += "os = " + System.capabilities.os + " | ";

capabilities += "version = " + System.capabilities.version + " | ";

capabilities += "language = " + System.capabilities.language + " | ";


External Data Support

To determine whether you can use particular functions and methods in AS, there are numerous properties of the System.capabilities object that can return particular information relating to external data:

  • System.capabilities.hasDataLoading—Returns whether the Flash Lite player can dynamically load additional data through several calls, including: loadMovie(), loadMovieNum(), loadVariables(), loadVariablesNum(), XML.parseXML(), Sound.loadSound(), MovieClip.loadVariables(), MovieClip.loadMovie(), MovieClipLoader.loadClip(), LoadVars.load(), and LoadVars.sendAndLoad(). The majority of these methods are covered throughout the book.

  • System.capabilities.hasSharedObjects—Returns whether the content can access Flash Lite shared objects.

  • System.capabilities.hasXMLSocket—Returns whether the host application supports XML sockets.

If you run the chapter3_ExternalDataSupport.fla file, you will see each of the data features supported by a particular device in Device Central.

Key and Device Interaction

There are six properties in System.capabilities that can help in determining and making the right choice of key input for device applications:

  • System.capabilities.hasMappableSoftKeys—Returns whether or not a user can set soft key values and handle events from those soft keys.

  • System.capabilities.softKeyCount—Returns a number specifying the total number of soft keys that the platform supports.

  • System.capabilities.has4WayKeyAS—Returns whether the player can execute ActionScript attached to Key Event handlers associated with the right, left, up, and down keys.

  • System.capabilities.hasQWERTYKeyboard—Returns whether or not ActionScript can be attached to all keys found on a standard QWERTY keyboard and the Backspace key.

  • System.capabilities.hasMouse—Returns whether or not the platform supports a mouse.

  • System.capabilities.hasStylus—Returns whether or not the player can send stylus-related events.

When you run the chapter3_KeySupport.fla file, you will see each of the key and interactivity features supported by a device in Device Central.

NOTE: There are a few terms here which relate to the sections Events and Event Listeners and Keys, Buttons, and Touch Input, which you’ll cover shortly.

Media Capabilities

The media capabilities of the device can also be detected from Flash Lite content through the System.capabilities object:

  • System.capabilities.audioMIMETypes—Returns an array of MIME types that the device’s audio codecs support, which can be used by the Sound object

  • System.capabilities.hasAudio—Returns whether or not the device supports audio

  • System.capabilities.hasCMIDI—Returns whether or not the platform supports CMIDI sound

  • System.capabilities.hasCompoundSound—Returns if the player can process compound sound data

  • System.capabilities.hasEmbeddedVideo—Returns whether or not the player can process embedded video

  • System.capabilities.hasMFI—Returns whether the player can play sound data in the Melody Format (MFi) audio format

  • System.capabilities.hasMIDI—Returns whether the player can play sound data in the MIDI audio format

  • System.capabilities.hasSMAF—Returns whether the player can play sound data in the Synthetic [music] Mobile Application Format (SMAF).

  • System.capabilities.hasStreamingAudio—Returns whether or not the device supports streaming audio

  • System.capabilities.hasMP3—Returns whether or not the device supports MP3

  • System.capabilities.hasStreamingVideo—Returns whether or not the player can stream video

  • System.capabilities.imageMIMETypes—Returns an array of MIME types that the device’s image codecs support, which can be used by loadMovie()

  • System.capabilities.MIMETypes—Returns an array of all the MIME types that the Sound and Video objects support, which can be used by loadMovie()

  • System.capabilities.videoMIMETypes—Returns an array of MIME types that the device’s video codecs support, which can be used by the Video object

If you run the chapter3_MediaSupport.fla file, you will see each of the media capabilities listed supported by a device in Device Central. You’ll get to cover the media capabilities of the Flash Lite Player in more detail in Chapter 7 of the book "Professional Flash Lite Mobile Development".

Communication Features

If you need your application to use email, SMS, or MMS, you can use the System.capabilities object to indicate whether these features are supported:

  • System.capabilities.hasEmail—Returns whether or not the player can send email messages using the getURL() function.

  • System.capabilities.hasSMS—Returns whether or not the player can send SMS

  • System.capabilities.hasMMS—Returns whether or not the player can send MMS.

When you run the chapter3_CommunicationSupport.fla file, you will see each of the communication features listed supported by a device in Device Central.

This article is excerpted from chapter 3 "Object-Oriented Programming for Flash Lite Development" of the book "Professional Flash Lite Mobile Development" by J. G. Anderson (ISBN: 978-0-470-54748-9, Wrox, 2010, Copyright Wiley Publishing Inc.)



Leave a Reply

Your email address will not be published. Required fields are marked *