February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

Loading content from txt file

Problem
Need load text from *.txt file.

Solution
Use URLRequest and URLLoader. Also using text and data methods.

Detailed explanation

var myTextObject:URLRequest=new URLRequest("my_content.txt");
var myLoaderObject:URLLoader = new URLLoader();

myLoaderObject.addEventListener(Event.COMPLETE,
myContentWasLoaded);
myLoaderObject.load(myTextObject);

function myContentWasLoaded(e:Event):void {
myContent_txt.text=myLoaderObject.data;
}

index25
An example is in the source in the attached files.

Source:
loading_content

Thank you for reading.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>