Helpful Information
 
 
Category: Flash & ActionScript
Text files with Flash MX

I'm a newbie to Flash so any assistance would be fantastic. What I am looking to do is every time an option is picked from a Combo box, text displays in a text field. Now I have a fair idea of how to do this normally (ie through using ActiveScript), but instead I want it to take the text from a text file (ie. *.txt).

So basically I click the option, it opens a txt file and displays its contents in a Flash text box. Is this possible to do, and if so would somebody kindly tell me how?

Thanks for you help.

I know it is possible but I have never done it but I have an example of one way to do it.

in the html file you put the link
this at the end of the link

?course=course_info.txt

so it will look like

<embed src="flash/menu.swf?info=info.txt">

You will notice that the this like take with it the values in the info.txt and puts them into info. I do not know what how many text files can be put in or how flash reads it. I just know it is possible.

You should post when you find out exactly how to do it so that we all can know.

:thumbsup:

Originally posted by TheDon
I'm a newbie to Flash so any assistance would be fantastic. What I am looking to do is every time an option is picked from a Combo box, text displays in a text field. Now I have a fair idea of how to do this normally (ie through using ActiveScript), but instead I want it to take the text from a text file (ie. *.txt).

So basically I click the option, it opens a txt file and displays its contents in a Flash text box. Is this possible to do, and if so would somebody kindly tell me how?

Thanks for you help.

Do you want different text diplayed for each option?

If so...

Put this actionscript in frame 1:


loadVariablesNum("data.txt", 0); //data.txt is where your data is stored.

For each check box (we'll say there are three for this example) you will need a different variable defined in your text file. Follow this syntax:



&var1=blahblahblah&var3=blahblahblah&var3=blahblahblah

Now you need to set up your buttons and text boxes.

Label your text boxes: box1, box2, box3

Each of your buttons will now need an action to take the variable from the loaded text file, and apply it to the text box.



on (release) {
_level0:box1 = _level0:var1; //loads var1 into the first text box
_level0:box2 = ""; //clears the other two boxes
_level0:box3 = "";
}


And that should do it!

Cheers.










privacy (GDPR)