2 Replies Latest reply on Apr 19, 2009 11:35 AM by ATIF FAROOQ

    please HELP! mousewheel issue!

    borfgordon

      Hi,

      I have a VBOX that contains a repeater that is creating a bunch of TextArea's within it that have htmltext values and they are selectable.

       

      The VBOX has "verticalScrollPolicy=true". When the vbox 1st renders the mouse wheel works and the scroll bar goes up/down. When the mouse moves over a "textarea" the mouse wheel stops working! I am guessing that this is a focus issue?

       

      I need the textareas to have focus so that the user can click on an HREF link in the textarea. However I also need the scrollbar to keep working with the mousewheel.

       

      How can I acheive this? Do I have to intercept mouse wheel events when the textarea is focused and somehow connect them back to the VBOX scrollbar?

       

      How can I do this?

       

      thanks!

        • 1. Re: please HELP! mousewheel issue!
          _Natasha_ Level 4

          It's easy to understand the behaviour of the flex component by it's source code.

           

          TextArea.as

          ...

          /**

               *  @private

               *  Mouse wheel scroll handler.

               *  TextField scrolls automatically so we don't need to handle this.

               */

              override protected function mouseWheelHandler(event:MouseEvent):void

              {

                  event.stopPropagation();

              }

          ...

           

          so if you create your class MyTextArea extends TextArea and override mouseWheelHandler to empty function you can get what you want.

          • 2. Re: please HELP! mousewheel issue!
            ATIF FAROOQ Level 3

            hi.

              you will need to add your own mouseWheel handler  on TextArea  and manually do the scroll on VBox so when Vbox loses focus and textArea gains it. VBox will still scroll even it dosent have the  focus. You can do something like this one

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
            
            <mx:Script>
                 <![CDATA[
                     import flash.events.MouseEvent;
                      public function onMouseWheel(e:MouseEvent):void{
                            e.target['parent'].dispatchEvent(e);
                      }
                 ]]>
            </mx:Script>
            
            <mx:VBox width="183" height="195" x="34" y="41" verticalScrollPolicy="on" id="vb">
                 <mx:TextArea id="area" width="152" text="sample text"  height="59" mouseWheel="onMouseWheel(event)"/>
                 <mx:TextArea id="area0" width="152" text="sample text"  height="59" mouseWheel="onMouseWheel(event)"/>
                 <mx:TextArea id="area1" width="152" text="sample text"  height="59" mouseWheel="onMouseWheel(event)"/>
                 <mx:TextArea id="area2" width="152" text="sample text"  height="59" mouseWheel="onMouseWheel(event)"/>
                 <mx:TextArea id="area3" width="152" text="sample text"  height="59" mouseWheel="onMouseWheel(event)"/>
                 <mx:TextArea id="area4" width="152" text="sample text"  height="59" mouseWheel="onMouseWheel(event)"/>
                 
            </mx:VBox>
            </mx:Application>