                     
         // The layout direction may have changed since last time the
         // popup was opened so need to reinit mirroring fields.
-       if (window is ILayoutDirectionElement)
-            ILayoutDirectionElement(window).invalidateLayoutDirection();
-
+        if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
+        {
+           if (window is ILayoutDirectionElement)
+                ILayoutDirectionElement(window).invalidateLayoutDirection();
+        }
+        
         if (modal)
         {
             // create a modal window shield which blocks input and sets up mouseDownOutside logic

import mx.automation.IAutomationObject;
import mx.core.FlexGlobals;
import mx.core.FlexSprite;
import mx.core.IChildList;
import mx.core.IFlexDisplayObject;
import mx.core.IFlexModule;

            
            // If the layout has been mirrored, then 0,0 is the uppper
            // right corner; compensate here.
            if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
            {
                if (popUp is ILayoutDirectionElement &&
                    ILayoutDirectionElement(popUp).layoutDirection == 
                    LayoutDirection.RTL)
                {
                     x = -x /* to flip it on the other side of the x axis*/ 
                         -popUp.width /* because 0 is the right edge */;
    
                }
            }
            
            pt = new Point(clippingOffset.x, clippingOffset.y);            
