DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Kalatravas has posted 29 posts at DZone. View Full User Profile

Loading External Text-file Into CS3 TextArea And Styling Through CSS

  • submit to reddit
        // Actualy the customTextArea is extending the Adobe's TextArea component . The class can be downloaded from here >>> .For more info visit

var style:StyleSheet = new StyleSheet();
style.setStyle(".heading", {fontWeight:"bold", color:"#FF0000", fontSize:22});
style.setStyle("body", {fontStyle:"italic" ,fontSize:18 , color:"#0000ff"});
style.setStyle(".customStyle" , {fontStyle:"italic" , fontSize:30 ,color:"#00ff00"});
customTextArea.setStyle("styleSheet", style);

var req:URLRequest = new URLRequest("externalText.txt");
var textLoader:URLLoader = new URLLoader();
textLoader.addEventListener(Event.COMPLETE , textLoaded);

function textLoaded(evt:Event):void {
    textLoader.removeEventListener(Event.COMPLETE , textLoaded);	
	customTextArea.htmlText =;