import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.conversion.TextConverter;
import flash.events.Event;
import flash.events.IOErrorEvent;
Load file
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("../SimpleText.xml")); // for example
loader.addEventListener(Event.COMPLETE,loadCompleteHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
/** on success parse the file and display it */
private function loadCompleteHandler(e:Event):void
{
editor.textFlow = TextConverter.importToFlow(e.target.data, TextConverter.TEXT_LAYOUT_FORMAT);
}
private function errorHandler(e:IOErrorEvent):void
{
editor.textFlow = TextConverter.importToFlow("\n"+IOErrorEvent(e).text, TextConverter.PLAIN_TEXT_FORMAT);
}