Buns of Aluminum
Buns of Aluminum

Reputation: 2439

How can I pass a Flex TextArea's scroll event up to Application?

I have a TextArea that I don't ever want to be scrolled. When scrolling within the application that holds this TextArea, however, the scrolling stops as soon as the mouse ends up over the TextArea.

Is there any way to pass the scroll event to the application, or tell the TextArea to not claim the event?

Upvotes: 2

Views: 1479

Answers (1)

Buns of Aluminum
Buns of Aluminum

Reputation: 2439

Found it. The ScrollControlBase that TextArea extends from catches the MOUSE_WHEEL event and dispatches a SCROLL event. To let the parent know that the mouse wheel was used, you have to dispatch the original mousewheel event again.

TL;DR: Add an event listener to the TextArea that catches and re-dispatches the MouseEvent.MOUSE_WHEEL event.

_textArea.addEventListener(
    MouseEvent.MOUSE_WHEEL, 
    function(e:MouseEvent):void 
    {
        dispatchEvent(e);
    }
);

Upvotes: 4

Related Questions