             -1;
     }
     
+    private function getGlobalViewPort():Rectangle
+    {
+        // We calculate the parent's concatenated matrix to deal with
+        // issues in the runtime where the concatenated matrix of the
+        // parent is out of sync.  See SDK-31538.
+        var m:Matrix = MatrixUtil.getConcatenatedMatrix(parent, stage);
+        var globalTopLeft:Point = m.transformPoint(localViewPort.topLeft);
+        
+        // Transform the bottom-right corner of the local rect
+        // instead of setting width/height to account for any
+        // transformations applied to ancestor objects.
+        var globalBottomRight:Point = m.transformPoint(localViewPort.bottomRight);
+        var globalRect:Rectangle = new Rectangle();
+        
+        // StageText can't deal with upside-down or mirrored rectangles
+        // or non-integer values. Fix those here.
+        globalRect.x = Math.floor(Math.min(globalTopLeft.x, globalBottomRight.x));
+        globalRect.y = Math.floor(Math.min(globalTopLeft.y, globalBottomRight.y));
+        globalRect.width = Math.ceil(Math.abs(globalBottomRight.x - globalTopLeft.x));
+        globalRect.height = Math.ceil(Math.abs(globalBottomRight.y - globalTopLeft.y));
+
+        return globalRect;
+    }
+    
+    private function hasOverlappingForm():Boolean
+    {
+        if (!localViewPort || !parent || !stageText || !awm)
+            return false;
+        
+        var globalRect:Rectangle = getGlobalViewPort();
+        var result:Boolean = false;
+        
+        for each (var otherForm:Object in awm.forms)
+        {
+            var otherFormDisplayObj:DisplayObject = otherForm as DisplayObject;
+            
+            if (otherFormDisplayObj && 
+                (!otherForm.hasOwnProperty("focusManager") || otherForm.focusManager != focusManager))
+            {
+                var formGlobalRect:Rectangle = otherFormDisplayObj.getBounds(stage);
+                
+                if (formGlobalRect.intersects(globalRect))
+                {
+                    result = true;
+                    break;
+                }
+            }
+        }
+        
+        return result;
+    }
+    
     /**
      *  Determine whether the given form is an application. This is the same
      *  check as is used by ActiveWindowManager.

     */ 
    override public function setFocus():void
    {
        // Do not set focus if the StageText is invisible (it has been replaced
        // by a proxy image). This component may be in a form that is lower in
        // z-order than the topmost form and we cannot allow the StageText,

    }
    
    /**
     *  For each form that the ActiveWindowManager knows about, add listeners
     *  for changes to geometry. These listeners are necessary because changes
     *  to the geometry of a form may cause popups to start or stop overlapping
     *  StageTexts. When that happens, StageTexts need to be replaced with proxy
     *  bitmaps or vice-versa.
     */
    private function updateWatchedForms(excludeForm:Object = null):void
    {
        if (awm)
        {
            for each (var form:Object in awm.forms)
            {
                if (form is EventDispatcher)
                {
                    var formDispatcher:EventDispatcher = form as EventDispatcher;
                    
                    // Remove event listeners in case we've already seen this form before.
                    formDispatcher.removeEventListener(MoveEvent.MOVE, form_moveHandler);
                    formDispatcher.removeEventListener(ResizeEvent.RESIZE, form_resizeHandler);
                    
                    if (form != excludeForm)
                    {
                        // Use weak references so we don't prevent the form from being garbage collected.
                        formDispatcher.addEventListener(MoveEvent.MOVE, form_moveHandler, false, 0, true);
                        formDispatcher.addEventListener(ResizeEvent.RESIZE, form_resizeHandler, false, 0, true);
                    }
                }
            }
        }
    }
    
    /**
     *  Stop watching for visibility and geometry events on all ancestors. Call
     *  this when disposing the StageText.
     */
