PDA

View Full Version : Learning Interactions and TXT file


Baptista
09-02-2002, 09:23 PM
I am creating a quiz using the learning interaction of flash 5. Because I have several questions and want to change them periodically I would like to type the question in a TXT file so the update would be fast.

How can extract the data from a txt file and load into each separate alternative field of the learning interaction. ?

JerryScript
09-03-2002, 03:30 AM
Your text file would be formatted with name value pairs separated by ampersands (&):

variable1=value1&variable2=value2&variable3=value3

Then, when you use load vars or nums, you'll get those variable names with those values. After load, you can set your objects to equal these variables values.

frame1
loadVars("file.txt", "target");

frame2
// nothing necessary

frame3
if(!framesLoaded(1)){gotoAndPlay(2);}

Then add actionscript to set your objects values to those of the variables.

Jerry

Baptista
09-03-2002, 04:02 AM
Jerry:

Thank you for your help. Because I will have approximately 30 questions, should I write question 1 with all the alternatives and save as question1.txt etc or would you think will be better if I put all together?
I am starting to work with actionscript so everything is a challenge.
Thanks again
Carlos

mad_A
09-16-2002, 09:59 AM
You would probably be better to load each seperately or in goroups so that you can be doing one question before they have all loaded.
Also it makes them easier to manage.

tg
09-16-2002, 03:29 PM
30 questions shouldn't take too long to load. i've loaded text files as large as 77kb. doesn't take any time at all, its what you do to the data after its loaded that can slow things down.