Adobe TextArea component – adding and controlling.
Posted on 16. Apr, 2009 by Michele in ActionScript 3 Snippets
Imports:
import fl.controls.*;//text area component
import flash.net.*;
import flash.text.*;
Load html text into TextArea component:
private function loadCaseOverviewText():void {
var urlLdr:URLLoader = new URLLoader();
urlLdr.addEventListener(Event.COMPLETE, completeTextLoadHandler);
urlLdr.dataFormat = URLLoaderDataFormat.TEXT;
urlLdr.load(new URLRequest(“text_assets/advertising_overview.html”));
}//loadCaseOverviewText
private function completeTextLoadHandler(event:Event):void {
var str:String = event.target.data as String;
textAreaCMP.htmlText = str;
}//completeTextLoadHandler
————
Position scrollbar back at top of TextArea component when new content is loaded or a new section is navigated to using:
textAreaCMP.verticalScrollPosition = 1;
————-
Set padding in TextArea component:
textAreaCMP.setStyle(“textPadding” , 10);
———–
Disable carat (bar) cursor from showing when rolling over textArea component:
textAreaCMP.drawFocus (false);


