Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Loading text into variables from .txt file



George
3/1/2004 8:02:18 PM
Hello, I have the following question.
Before I begin, I would like to say that I am completely lost with the
changes in actionscript for MX2004. But that is besides the point, and I
might be surprised with some kind of new command to do this ;). In any
case, I searched the forum, and there are lots of fragments of info on the
subject, but I am still not sure on how to do this in Flash MX2004.

Note that it is for recreational use, so there is no major hurry on your
help, although it will help me for future projects to acquire the knowledge.

Anyways, here it goes:

My friends and I have a soccer team. Out of the 11 positions on the field,
there is always rotating personell, for one reason or another.

I designed a soccer field with the positions marked on the field. Next to
each position, I created a Dynamic Text box, each with its corresponding
variable name.
P1, P2, P3,-----> P11.

I would love to be able to upload a .txt file with data similar to this in
order to feed my flash movie, and display the name of the player for that
week next to its position.

P1="John"
P2="Larry"
etc...


Question: What is the best way to do this?

Thanks,

George

George
3/1/2004 9:29:47 PM
Self Reply.

I am happy to say, although in little bit of disbelief, that the answer is
simpler than I had read in the forums, or could understand from the manual.
Surprising!!!

textfile (1.txt):

&p1=John
&p2=Jack
&p3=Larry

Button Action in FLASH:


on(release){
loadVariablesNum("1.txt", 0);
}


Amazingly, it plugs right into the dynamic text boxes.



I was trying to avoid all of this talk of splitting the text file and
such... but since I only had 11 variables, didn't have to mess with arrays
and stuff.

Thanks if anyone put any thought into this.

A happy camper,

George



[quoted text, click to view]

AddThis Social Bookmark Button