      *  object. The rectangle is in the coordinate system relative to the
      *  <code>stopParent</code> parameter.
      */  
-    public function getVisibleRect(stopParent:DisplayObject):Rectangle
-    {
-        if (!stopParent)
-            stopParent = DisplayObject(systemManager);
+    public function getVisibleRect(targetParent:DisplayObject):Rectangle
+    {
+        if (!targetParent)
+            targetParent = DisplayObject(systemManager);
             
-        var pt:Point = new Point();
-        pt.x = x;
-        pt.y = y;
+        var pt:Point = new Point(x, y);
         pt = $parent.localToGlobal(pt);
-        pt = stopParent.globalToLocal(pt);
+        
+        // bounds of this object to return. Keep in global coordinates
+        // until the end and set back to targetParent coordinates.
         var bounds:Rectangle = new Rectangle(pt.x, pt.y, width, height);
         var current:DisplayObject = this;
-        var currentRect:Rectangle;
-        var currentParent:DisplayObject;
+        var currentRect:Rectangle = new Rectangle();
         
         do
         {

     *  Get the bounds of this object that are visible to the user
     *  on the screen.
     * 
     *  @param stopParent The parent to stop at when calculating the visible
     *  bounds. If null, this object's system manager will be used as
     *  the parent.
     * 

            else
                current = current.parent;
                
            if (current.scrollRect)
            {
                // clip the bounds by the scroll rect
                currentRect = current.scrollRect.clone();
                pt = current.localToGlobal(currentRect.topLeft);
                currentRect.x = pt.x;
                currentRect.y = pt.y;
                bounds = bounds.intersection(currentRect);
            }
        } while (current != targetParent); 

        // convert the rect relative to the stop parent
        pt = targetParent.globalToLocal(bounds.topLeft);
        bounds.x = pt.x;
        bounds.y = pt.y;
        return bounds;       
    }

