 
 package mx.components
 {
+import flash.events.FocusEvent;
+import flash.events.MouseEvent;
 import flash.events.KeyboardEvent;
+import flash.text.TextField;
 import flash.ui.Keyboard;
 
 import mx.components.baseClasses.FxComponent;

            if (!isNaN(vspDelta))
            {
                vp.verticalScrollPosition += vspDelta;
            }
        }


            if (!isNaN(hspDelta))
            {
                vp.horizontalScrollPosition += hspDelta;
                event.preventDefault();
            }
        }
    }
    
    private function mouseWheelHandler(event:MouseEvent):void
    {
        var vp:IViewport = viewport;
        if (!vp || event.isDefaultPrevented())
            return;

        var nSteps:uint = Math.abs(event.delta);
        var unit:ScrollUnit;

        if (verticalScrollBar && verticalScrollBar.visible)
        {
            unit = (event.delta < 0) ? ScrollUnit.DOWN : ScrollUnit.UP;
            for(var vStep:int = 0; vStep < nSteps; vStep++)
            {
                var vspDelta:Number = vp.getVerticalScrollPositionDelta(unit);
                if (!isNaN(vspDelta))
                    vp.verticalScrollPosition += vspDelta;
            }
            event.preventDefault();
        }
        else if (horizontalScrollBar && horizontalScrollBar.visible)
        {
            unit = (event.delta < 0) ? ScrollUnit.LEFT : ScrollUnit.RIGHT;
            for(var hStep:int = 0; hStep < nSteps; hStep++)
            {
                var hspDelta:Number = vp.getHorizontalScrollPositionDelta(unit);
                if (!isNaN(hspDelta))
                    vp.horizontalScrollPosition += hspDelta;
            }
            event.preventDefault();
        }            
    }
    
    /**
     *  @private
     */ 
    override protected function focusInHandler(event:FocusEvent):void
    {
         addSystemHandlers(MouseEvent.MOUSE_WHEEL, mouseWheelHandler, mouseWheelHandler);
    }
    
    /**
     *  @private
     */
    override protected function focusOutHandler(event:FocusEvent):void
    {
        removeSystemHandlers(MouseEvent.MOUSE_WHEEL, mouseWheelHandler, mouseWheelHandler);
    }    
        
}

