ActionScript Device object

Description

The Device object is a Nokia-proprietary ActionScript 2.0 extension that allows Flash Lite applications to access device features and to retrieve and modify system properties. The Device object gives you more control over how your Flash Lite application behaves on a device.

Note: Before you can create Flash Lite applications that use the Device object, you must install the corresponding ActionScript 2.0 class files for your Flash IDE. For further instructions, see section Installing the ActionScript class files at the end of this page.

The Device object is supported since Flash Lite Player 3.1 on S60 5th Edition and selected S60 3rd Edition, Feature Pack 2 devices. While you can publish your application for Flash Lite 2.0 or newer, the Device object only works on S60 devices that support Flash Lite 3.1.

The following table lists the methods provided by the Device object.

Table: Device object methods

Method

Description

DisableAutoRotation

Disables automatic screen rotation on the device.

ExpediteConnection

Starts the network connection setup process for the Flash Lite application.

Syntax

To create a Device object, use the new method. Before using the method, you need to import the com.nokia.lib.Device class.

The following code snippet creates a new Device object:

import com.nokia.lib.Device;
var deviceObject:Object = new Device();

Arguments

Creating a new Device object requires no arguments.

Return value

The new method returns a Device object for a successful call. You can use the object to call the various Device object methods (see above).

Example code

The following code snippet creates a new Device object and uses it to call the ExpediteConnection method:

import com.nokia.lib.Device;

var deviceObject:Object = new Device();
deviceObject.ExpediteConnection();

Installing the ActionScript class files

Before you can create Flash Lite applications that use the Device object, you must install the corresponding ActionScript 2.0 class files for your Flash IDE:

  1. Download the S60 ActionScript API library package (ZIP) to your computer by clicking the following link:

    S60_ActionScript_API_library_1_0.zip

  2. Extract the package to the class path folder of your Flash IDE. For example, if you are using Adobe Flash CS4 on Microsoft Windows XP, extract the package to:

    %USERPROFILE%\Local Settings\Application Data\Adobe\Flash CS4\en\Configuration\Classes\

    Make sure that the extracted ActionScript class files (.as) are located in:

    <classpath>\com\nokia\lib\

You can now create Flash Lite applications that use the Device object.