Random Load Text HELP!

Hey guys. I’m an amateur flash developer and I need desperate help. I have no skills in random what so ever. I’m trying to make a fortune cookie/advice doodad that randomly loads a line of text from an external txt file but I have no idea how to do it. PLEASE HELP ME!!! I will give you credit in the file and on my site and in resources.

-aussy

Place a textfield on stage. Give it an instance name of “myText” (no quotes).
Now open your notepad and write the following lines:[AS]text1=text 1 goes here&text2=text 2 goes here&text3=text 3 goes here&[/AS]You can enter as many variables you want. In this example we are working with 3 diferent lines. Save the file as txtfile.txt

Now place the following code on the first frame of your main timeline:[AS]loadText = new loadVars();
loadText.load(“txtfile.txt”);
loadText.onLoad = function(OK) {
if (OK) {
myText.Text = this[“text”+(Math.floor(Math.random()*3)+1)]; //i used 3 because we are working with only 3 different texts inside the txt file
}
};[/AS]

Thanks A LOT!!! Usually people don’t respond to my plees of help and pity but luckily someone did. Hopefully it works. If so you’ll definitely will be on my thank list.

Im sure it works :slight_smile:
Good Luck!

:wink:

[edit] i forgot to say your textfield should be set as dynamic text[/edit]