Hack to disable Flash Lite auto screen orientation/rotation on Nokia 5800 (and others)

Posted in Development, Flash Lite, tips on Apr 23, 2009

It’s cool Nokia 5800 automatically rotates the screen to landscape/portrait according to phone orientation. However, you do not want that to happen always when developing Flash Lite applications. Apparently there is no way to disable this ‘freature’ directly from Flash Lite [1]. UPDATE: After my post, Nokia published a new platform service API to disable auto rotation. Please see here.

Below is a hack to disable auto rotation / orientation change from a Flash Lite project for Nokia 5800 (360×640 screen). It simply rotates the main Movieclip to rotate -90 degrees and back whenever an orientation change is detected. It’s not the perfect solution, however will keep you going until Nokia or Adobe fixes the real problem. (Note: You need a main Movieclip for this to work)

var stageSizeListener:Object = new Object();
stageSizeListener.onResize=function()
{
if(Stage.width > Stage.height) {
_root.main._rotation = -90;
_root.main._x = 0;
_root.main._y = 360;
} else {
_root.main._rotation = 0;
_root.main._x = 0;
_root.main._y = 0;
}
}
Stage.addListener(stageSizeListener);

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Slashdot
  • Technorati
  • email
  • Facebook
  • Furl
  • Google Bookmarks
  • LinkedIn
  • Mixx
  • Netvouz
  • NewsVine
  • Pownce
  • Reddit
  • StumbleUpon
  • TwitThis

Trackback URI | Comments RSS

5 Responses to “ Hack to disable Flash Lite auto screen orientation/rotation on Nokia 5800 (and others) ”

  1. # 1 Flash Lite Tips: How to disable Flash Lite auto screen orientation/rotation on Nokia 5800 | Adobe Flash Lite Says:

    [...] — Tags: 5800, s60 5th, Tips — Li YongFei @ 9:14 am ugur has posted a new tip, how to disable auto rotation / orientation change from a Flash Lite project for Nokia 5800 (360×640 screen). It simply rotates the main Movieclip to rotate -90 degrees and back [...]

  2. # 2 PTM - Pasi Manninen - Flash, Flash Lite and Flex Developer Says:

    [...] is just what many Flash Lite Developers wanted. Of course we can use AS code to “disable Flash Lite auto screen orientation/rotation on Nokia 5800: Kuneri” and so on but finally a good solution is available and it is really easy to use (only a few lines [...]

  3. # 3 Objeto Device en Flash Lite 3.1 bajo Nokia S60 5th Edition | BlocketPc :: Flash Lite y Mobile Web Says:

    [...] – Desactiva la característica de autorotación, para la que había algún tip básico que me recordó a técnicas usadas en el [...]

  4. # 4 tasmanic Says:

    This also works without the main movie:

    var stageSizeListener:Object = new Object();
    stageSizeListener.onResize=function()
    {
    if(Stage.width > Stage.height) {
    _root._rotation = -90;
    _root._x = 0;
    _root._y = 360;
    } else {
    _root._rotation = 0;
    _root._x = 0;
    _root._y = 0;
    }
    }
    Stage.addListener(stageSizeListener);

  5. # 5 nnhan Says:

    Hi,

    I tested like your code, but with dynamic text, it didn’t work fine.
    _root._rotation = -90;

    Text of dynamic text not rotation. Its rotation is still 0.

    I don’t why?

    Please help me.

    Thanks.

Speak your peace!