2 Replies Latest reply on Sep 6, 2007 12:32 PM by phi2265

    Disable scrolling via mouse wheel

    phi2265 Level 1
      Here's my situation.

      I have a TextArea that is filled with text(more text than can be displayed). I have the scroll bars removed so that you can not scroll with them, but you can still scroll with a mouse wheel. How can I disable this? I've tried a number of things but nothing seems to be working.

      I'm thinking I need an event listener, and a function needs to be performed on ScrollEvent.SCROLL, but what would it be? TextArea doesn't have scrollPosition, so I can't do myTextArea.scrollPosition = 0; or something of that sort.

      If anyone has an idea of how to go about this, throw it up on the board, it'd be really appreciated.

      Thanks!
        • 1. Disable scrolling via mouse wheel
          phi2265 Level 1
          Here's something else I tried..

          public function wheelStop():void{
          myTextArea.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
          }

          public function mouseWheelHandler(event:MouseEvent):void{
          event.stopImmediatePropagation();
          }

          and I called wheelStop() in the creationComplete function and also tried it in mouseWheel in the TextArea, neither worked..

          edit:
          also tried myTextArea.addEventListener(ScrollEvent.SCROLL, mouseWheelHandler);
          • 2. Re: Disable scrolling via mouse wheel
            phi2265 Level 1
            As I couldn't find anything on this anywhere.. I'll post the solution I got from the FlexCoders yahoo group.

            package
            {
            import mx.controls.TextArea;

            public class newTextArea extends TextArea
            {
            override protected function createChildren():void
            {
            super.createChildren();
            textField.mouseWheelEnabled = false;
            }
            }
            }

            -----------------

            <mx:Application xmlns:mx=http://www.adobe.com...." xmlns:local="*" .... />
            <local:newTextArea ..... />

            provided by Alex Harui - blogs.adobe.com/aharui