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>
<![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);
}
]]>
</mx:Script>
<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);">
enjoy!
1 comment:
This is a great find. Well done.
I have my evening back now :)
Post a Comment