                     checkForInvalidScrollPositions();
                 }
                 break;
+        }
+    }
+    
+    /**
+     *  @private 
+     *  Listens for any focusIn events from descendants 
+     */ 
+    override protected function focusInHandler(event:FocusEvent):void
+    {
+        super.focusInHandler(event);
+        
+        // When we gain focus, make sure the focused element is visible
+        if (viewport && ensureFocusedElementIsVisible)
+        {
+            var elt:IVisualElement = focusManager.getFocus() as IVisualElement; 
+            lastFocusedElement = elt;
+            
+            if (elt)
+                scrollElementIntoView(elt);
+        }
+        
+    }
+    
+    /**
+     *  @private
+     *  Scrolls the viewport so the element is visible in the viewable area  
+     */ 
+    private function scrollElementIntoView(element:IVisualElement):void
+    {   
+        var layout:LayoutBase = null;
+        
+        if (viewport is GroupBase)
+            layout = GroupBase(viewport).layout;
+        else if (viewport is SkinnableContainer)
+            layout = SkinnableContainer(viewport).layout;
+     
+        if (layout)
+        {
+            // Scroll the element into view
+            var delta:Point = layout.getScrollPositionDeltaToAnyElement(element);
+            
+            if (delta)
+            {
+                var eltBounds:Rectangle = layout.getChildElementBounds(element);
+                var focusThickness:Number = 0;
+                
+                viewport.horizontalScrollPosition += delta.x; 
+                viewport.verticalScrollPosition += delta.y;
+                
+                if (element is IStyleClient)
+                    focusThickness = IStyleClient(element).getStyle("focusThickness");
+                
+                // Make sure that the focus ring is visible. Top and left sides have priority
+                if (focusThickness)
+                {
+                    if (viewport.verticalScrollPosition > eltBounds.top - focusThickness)
+                        viewport.verticalScrollPosition = eltBounds.top - focusThickness;
+                    else if (viewport.verticalScrollPosition + height < eltBounds.bottom + focusThickness)
+                        viewport.verticalScrollPosition = eltBounds.bottom + focusThickness - height;
+                    
+                    if (viewport.horizontalScrollPosition > eltBounds.left - focusThickness)
+                        viewport.horizontalScrollPosition = eltBounds.left - focusThickness;
+                    else if (viewport.horizontalScrollPosition + width < eltBounds.right + focusThickness)
+                        viewport.horizontalScrollPosition = eltBounds.right + focusThickness - width;
+                }
+                                
+                if (viewport is UIComponent)
+                    UIComponent(viewport).validateNow();
+            }
         }
     }
     

     */
    private var inTouchInteraction:Boolean = false;
    
    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------
    
    //----------------------------------
    //  horizontalScrollBar

import spark.effects.easing.IEaser;
import spark.effects.easing.Power;
import spark.effects.easing.Sine;
import spark.layouts.supportClasses.LayoutBase;
import spark.utils.MouseEventUtil;

use namespace mx_internal;
