Skip to main content
Known Participant
August 28, 2009
Answered

Import and read a file in AS3

  • August 28, 2009
  • 1 reply
  • 3432 views

Using AS3, I want to extracte data from a file to fill in my arrays.

I would like to do this without using php and server side coding

all done in AS3

the file can be a spread sheet

thx in advance

This topic has been closed for replies.
Correct answer kglad

var urlLDR:URLLoader=new URLLoader();

var urlR:URLRequest=new URLRequest("yourfile.txt");

urlLDR.addEventListener(Event.COMPLETE,f);

urlLDR.load(urlR);

function f(e:Event){

trace(e.target.data);

}

1 reply

kglad
Community Expert
Community Expert
August 28, 2009

use the urlloader class.

mimihayekAuthor
Known Participant
August 28, 2009

Do you have an example to show, I will appreciate help

mimi

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 28, 2009

var urlLDR:URLLoader=new URLLoader();

var urlR:URLRequest=new URLRequest("yourfile.txt");

urlLDR.addEventListener(Event.COMPLETE,f);

urlLDR.load(urlR);

function f(e:Event){

trace(e.target.data);

}