 import mx.events.ItemExistenceChangedEvent;
 import mx.layout.HorizontalLayout;
 import mx.layout.VerticalLayout;
+import mx.managers.IFocusManagerComponent;
 import mx.skins.spark.FxDefaultItemRenderer;
+import flash.geom.Point;
 
 /**
  *  @copy mx.components.baseClasses.GroupBase#alternatingItemColors

    
    /**
     *  @private
     *  Build in basic keyboard navigation support in List. 
     *  TODO: Deepa - add overrideable methods to control 
     *  keyboard navigation across components and layout. 
     */
    private function list_keyDownHandler(event:KeyboardEvent):void
    {
        var nextInView:Number;
        switch (event.keyCode)
        {
            case Keyboard.UP:
            {
                if (layout is VerticalLayout)
                {
                    nextInView = VerticalLayout(layout).inView(selectedIndex-1); 
                    //The next item is already in full or partial view - don't scroll, just select it.
                    if ((nextInView == 1) || (nextInView < 0))
                        event.stopPropagation();
                    //The last item was selected and partially in view, don't increment selection 
                    if (nextInView == 0 && (VerticalLayout(layout).firstIndexInView == selectedIndex))
                        return;
                    //Adjust selection 
                    if (selectedIndex > 0)
                        selectedIndex--;
                }
                break;
            }
            case Keyboard.DOWN:
            {
                if (layout is VerticalLayout)
                {
                    nextInView = VerticalLayout(layout).inView(selectedIndex+1);
                    //The next item is already in full or partial view - don't scroll
                    if ((nextInView == 1) || (nextInView < 0))
                        event.stopPropagation();
                    //The last item was selected and partially in view, don't increment selection 
                    if (nextInView == 0 && (VerticalLayout(layout).lastIndexInView == selectedIndex))
                        return;
                    //Adjust selection 
                    if (selectedIndex < (dataProvider.length - 1))
                        selectedIndex++;
                }
                break;
            }
            case Keyboard.LEFT:
            {
                if (layout is HorizontalLayout)
                {
                    nextInView = HorizontalLayout(layout).inView(selectedIndex-1); 
                    //The next item is already in full or partial view - don't scroll
                    if ((nextInView == 1) || (nextInView < 0))
                        event.stopPropagation();
                    //The last item was selected and partially in view, don't increment selection 
                    if (nextInView == 0 && (HorizontalLayout(layout).firstIndexInView == selectedIndex))
                        return;
                    //Adjust selection 
                    if (selectedIndex > 0)
                        selectedIndex--;
                }
                break;
            }
            case Keyboard.RIGHT:
            {
                if (layout is HorizontalLayout)
                {
                    nextInView = HorizontalLayout(layout).inView(selectedIndex+1); 
                    //The next item is already in full or partial view - don't scroll
                    if ((nextInView == 1) || (nextInView < 0))
                        event.stopPropagation();
                    //The last item was selected and partially in view, don't increment selection 
                    if (nextInView == 0 && (HorizontalLayout(layout).lastIndexInView == selectedIndex))
                        return;
                    //Adjust selection 
                    if (selectedIndex < (dataProvider.length - 1))
                        selectedIndex++;
                }
                break;
            }            
        }
    }
  

    {
        super();
        
        // This listener handles the arrow keys.   It runs at capture time 
        // so that can cancel - Event.preventDefault() - events we've processed
        // before they're seen by the skin's FxScroller
        addEventListener(KeyboardEvent.KEY_DOWN, list_keyDownHandler, true);
    }
    
