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();
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;