Hack to disable Flash Lite auto screen orientation/rotation on Nokia 5800 (and others)
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);
















April 23rd, 2009 at 17:14
[...] — 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 [...]
June 4th, 2009 at 13:43
[...] 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 [...]
June 22nd, 2009 at 18:09
[...] – 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 [...]
September 24th, 2009 at 21:28
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);
January 20th, 2010 at 5:58
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.