             
         switch (unit)
         {
-            case Keyboard.UP:
+            case ScrollUnit.UP:
                 return (scrollR.y <= 0) ? 0 : -1;
                 
-            case Keyboard.DOWN:
+            case ScrollUnit.DOWN:
                 return (scrollR.y >= maxDelta) ? 0 : 1;
                 
-            case Keyboard.PAGE_UP:
+            case ScrollUnit.PAGE_UP:
                 return Math.max(minDelta, -scrollR.height);
                 
-            case Keyboard.PAGE_DOWN:
+            case ScrollUnit.PAGE_DOWN:
                 return Math.min(maxDelta, scrollR.height);
                 
-            case Keyboard.HOME: 
+            case ScrollUnit.HOME: 
                 return minDelta;
                 
-            case Keyboard.END: 
+            case ScrollUnit.END: 
                 return maxDelta;
                 
             default:

            
        switch (unit)
        {
            case Keyboard.UP:
                return (scrollR.x <= 0) ? 0 : -1;
                
            case Keyboard.DOWN:
                return (scrollR.x >= maxDelta) ? 0 : 1;
                
            case Keyboard.PAGE_UP:
                return Math.max(minDelta, -scrollR.width);
                
            case Keyboard.PAGE_DOWN:
                return Math.min(maxDelta, scrollR.width);
                
            case Keyboard.HOME: 
                return minDelta;
                
            case Keyboard.END: 
                return maxDelta;
                
            default:


import mx.core.IViewport;
import mx.core.UIComponent;
import mx.core.ScrollUnit;
import mx.events.FlexEvent;
import mx.events.TextOperationEvent;
import mx.utils.TextUtil;
