PDA

View Full Version : Load Array Form Text File


Dmasta
02-16-2002, 05:28 PM
Ok im fairly new at flash and I have read tutorials but i am stuck so I have come for some help. I want to load an array from a text file but so far I havenvt been able to do it can somebody save me?

tg
02-16-2002, 05:45 PM
here is one way

your text file looks like this

&myVals=one,two,three,four,five&eof=1&

your flash file looks like this

main timeline frame one

this.loadVariables("mytextfile.txt");

main timeline frame two is blank
main timeline frame three

if(eof!="1"){
gotoAndPlay(prevFrame);
}
var myArray;
//splits the string into the array
myArray=myVals.split(",");
//do this to see what you have in the array
for(i=0;i<myArray.length;i++){
trace("myArray["+i+"]="+myArray[i]);
}


havn't tested the exact code i have given you, but im pretty sure this one will work, i done a bunch of these for work.