View Full Version : loadVariablesNum ("test.txt", 0);

05-11-2001, 07:36 PM
Hi Gang, I am trying to load variables from a text file and soon I will be trying to pull from a db like in Jesse's Tutorial on pulling from a db. (http://www.actionscripts.org/tutorials/intermediate/loadVariables_script_interaction/index.shtml)

Anyway back to the question
1. Does the loadVariablesNum() need to be in a on "event"() to fuction correctly?

What I am trying to do is load my var's on the second frame then show them on frame 3 for rest of the movie, but what happens is I have to run through the entire movie then replay it and then my var's will display

code for frame 2
loadVariablesNum ("test.txt", 0);
var_output1 = var1+" "+var2;
var_output1 = String(var_output1);
if (var_output1.length == 0) {
gotoAndPlay (1);
} else if (var_output1.length == 1) {
gotoAndPlay (3);

With the above code I belive that I am checking to see if the var's are loaded and if not do a loop and keep checking
untill they load

well my movie loads and plays frame 3 but no var's erver show up untill I run the movie again


05-15-2001, 05:45 AM
I've found that if you give it a little more time to load the data it works better. It won't work, at least I don't think it will work if it's all in one frame. Spread it out. Call the text.txt in frame 2 then give it a couple of frames maybe 10 or so then do the check loop in between those frames. Maybe keep setting your var_output1 = var1+" "+var2; var_output1 = String(var_output1); on different frames then on the last frame use the
if (var_output1.length == 0) {
gotoAndPlay (1);
} else if (var_output1.length == 1) {
gotoAndPlay (11);

Well maybe that helps, it's probably an inefficent way of doing it but it should work better. Also I'd watch out for the string function, it's probably returning a value even know there's not one. There for it goes to frame 3 in your code.

05-30-2001, 07:21 PM
for me it works this way...

put in some frame before (i always put it at the begining of the movie):
var check="off";

and type in the text file with all of your other variables:

and then in some frame after (let's say label "loading"):
loadVariablesNum ("variables.txt", 0);

and then in frame just after that:
if (check eq "off") {
gotoAndPlay ("loading");
} else {
gotoAndPlay ("wherever_you_want_coz_you_have_your_variables_load ed");

[email protected]