Q:

Read a string in AS3

I have a question regarding to my project which is how to read a string in AS3. 
Actually, I have an text file named test.txt. For instance:
It consists of:
 Sun,Mon,Tue,Wed,Thu,Fri,Sat
and then I want to put all of them into an array and then a string to show them in the dynamic text Box called text_txt:
var myTextLoader:URLLoader = new URLLoader();

myTextLoader.addEventListener(Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void
{
 var days:Array = e.target.data.split(/\n/);
 var str:String;
 stage.addEventListener(MouseEvent.CLICK, arrayToString);

 function arrayToString(e:MouseEvent):void
  {
    for (var i=0; i<days.length; i++)
    {
        str = days.join("");
        text_txt.text = str + "\n" + ";"; //it does not work here
    }
 }
}

myTextLoader.load(new URLRequest("test.txt"));

BUT IT DOES NOT show them in different line and then put a ";" at the end of each line !
I can make it to show them in different line, but I need to put them in different line in txt file and also I still do not get the ";" at the end of each line unless put it in the next file also at the end of each line.
And then I want to read the string and show an object from my library based on each word or line. for example:
//I  do not know how to write it or do we have a function to read a string and devide it to the words after each space or line 
if (str.string="sun"){
 show(obj01);
}
if (str.string="mon"){
 show(obj02);
}

I hope I can get the answer for this question.
Please inform me if you can not get the concept of the last part. I will try to explain it more until you can help me.
Thanks in advance 

A:

you must enable multiline ability for your TextField (if did not)

adobe As3 DOC :

join() Converts the elements in an array to strings, inserts the
  specified separator between the elements, concatenates them, and
  returns the resulting string. A nested array is always separated by a
  comma (,), not by the separator passed to the join() method.

so str = days.join(""); converts the Array to a single string, and as your demand ( parameter passed to join is empty "") there is no any thing between fetched lines. and text_txt.text = str + "\n" + ";"; only put a new line at the end of the text once.
var myTextLoader:URLLoader = new URLLoader();
var days:Array;

myTextLoader.addEventListener(Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void
{
    days = e.target.data.split(/\n/);
    var str:String;
    stage.addEventListener(MouseEvent.CLICK, arrayToString);
}

myTextLoader.load(new URLRequest("test.txt"));

function arrayToString(e:MouseEvent):void
{
    text_txt.multiline = true;
    text_txt.wordWrap = true;
    text_txt.autoSize = TextFieldAutoSize.LEFT;
    text_txt.text = days.join("\n");
}

also i moved arrayToString out of onLoaded 
for second Question: to checking existance of a word, its better using indexOf("word") instead comparing it with "==" operator, because of invisible characters like "\r" or "\n".
if (str.indexOf("sun") >= 0){
    show(obj01);
}
if (str.indexOf("mon") >= 0){
    show(obj02);
}

