DisableAutoRotation()

Description

The DisableAutoRotation method disables (and enables) automatic screen rotation on the device. This method is provided by the Device object.

Automatic screen rotation is enabled by default on S60 5th Edition devices and those S60 3rd Edition, Feature Pack 2 devices that support it. If you do not want the screen orientation to change when the user rotates the devices, disable the feature for your application. Disabling automatic screen rotation can be useful, if your application does not support dynamic layout control for different orientations, or if you want to avoid the screen flickering that can occur with orientation changes.

Automatic screen rotation is only disabled for the application that calls the DisableAutoRotation method.

Syntax

DisableAutoRotation(condition:Boolean):Number

Arguments

  • condition:

    This is a boolean value that determines whether automatic screen rotation is disabled (true) or enabled (false) for the application.

    To disable automatic screen rotation, call the method with the argument set to true:

    DisableAutoRotation(true)

    To re-enable automatic screen rotation, call the method with the argument set to false:

    DisableAutoRotation(false)

Return value

The DisableAutoRotation method returns a number that indicates the status code for the call.

Table: DisableAutoRotation status codes

Status code

Description

0

Success

-304

General error

-307

Method is not supported

-308

Method called with invalid input

Example code

The following code snippet creates a new Device object and uses it to disable automatic screen rotation with the DisableAutoRotation method:

import com.nokia.lib.Device;

var deviceObject:Object = new Device();
// Disable automatic screen rotation
deviceObject.DisableAutoRotation(true);

To download an example Flash Lite application that uses the DisableAutoRotation method, see section Flash Lite applications.