Prevent MouseWheel scroll on TextArea Flex(3.4)

I’ve had a really hard time figuring this out, plus I couldn’t find a viable solution through web-search. So I’m posting my solution with full code.
This example also shows how to set focus on a textArea simply by mouseOver it.

<mx:Script&gt
<![CDATA[
public function setScroll(event:Event):void{

try
{
event.target.mx_internal::getTextField().mouseWheelEnabled=false;
}
catch (err:Error)
{

trace(err.message);
}
finally
{
// event.verticalScrollPosition=0;
}
}

private function setFocusOnStart(event:Event):void
{
stage.focus=InteractiveObject(event.currentTarget);
}
]]&gt
</mx:Script&gt

<mx:TextArea id=”gta1″ width=”540″ height=”92.5″ editable=”false” mouseOver=”setFocusOnStart(event)” wordWrap=”true” borderStyle=”none” fontSize=”13″ verticalScrollPolicy=”off” leading=”4″ kerning=”true” letterSpacing=”0″ maxChars=”400″ selectable=”false” backgroundAlpha=”1.0″ paddingBottom=”0″ liveScrolling=”false” creationComplete=”setScroll(event);”&gt

enjoy!

Facebooktwittergoogle_pluspinterestlinkedin
linkedin
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *