             
             if (softKeyboardBehavior == "none" && resizeForSoftKeyboard)
             {
-                var sm:SystemManager = systemManager as SystemManager;
-                var scaleFactor:Number = 1;
+                var appHeight:Number = (stage.stageHeight - keyboardRect.height) / scaleFactor;
+                var appWidth:Number = stage.stageWidth / scaleFactor;
                 
-                // Account for any density scaling
-                if (sm)
-                    scaleFactor = sm.densityScale;
+                if (appHeight != height || appWidth != width)
+                {
+                    setActualSize(appWidth, appHeight);
+                    validateNow(); // Validate so that other listeners like Scroller get the updated dimensions
+                }
                 
-                var appHeight:Number = (stage.stageHeight - keyboardRect.height) / scaleFactor;
-                
-                if (appHeight != height)
+                // update the screen size cache
+                if (keyboardActiveInOrientationChange)
                 {
-                    setActualSize(width, appHeight);
-                    validateNow(); // Validate so that other listeners like Scroller get the updated dimensions
+                    keyboardActiveInOrientationChange = false;
+                    updateScreenSizeCache(appWidth, appHeight);
                 }
             }
         }

            
            isSoftKeyboardActive = false;
            
            if (softKeyboardBehavior == "none" && resizeForSoftKeyboard)
            {
                var sm:SystemManager = systemManager as SystemManager;
                var scaleFactor:Number = 1;
                
                // Account for any density scaling
                if (sm)
                    scaleFactor = sm.densityScale;
                
                // Restore the original values
                setActualSize(stage.stageWidth / scaleFactor, stage.stageHeight / scaleFactor);
                

import flash.system.Capabilities;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.utils.Dictionary;
import flash.utils.setInterval;

import mx.core.EventPriority;
