View Full Version : getting variables into flash
safirjunk
09-18-2002, 10:31 AM
I have a *.txt document that contains a number between 0 and 9.
example (in *.txt document) : &number=6
now I want to use that number to control a loop
like =
for (i=0;i<=number;i++) {
trace(i);
}
my problem is that i cant load the number into flash itself.
I can load the number into a dynamic textfield, but that isn't what I want.
can anyone help me?
thanks
farafiro
09-18-2002, 10:39 AM
I think the problem is with the name u chosed (number), change it and try again
safirjunk
09-18-2002, 11:08 AM
doesn't work either
this is what I do:
i've got a txt-file in the same directory as the fla movie
in that txt-file there is: &nummer=6
if i do this:
this.loadVariables("nummer.txt");
trace(nummer);
i get undefined as an answer
hope someone can help me
farafiro
09-18-2002, 11:33 AM
try thisloadVariablesNum("nummer.txt",1)
then u can call the variable from the text file from the _root
safirjunk
09-18-2002, 11:41 AM
It must be me or something like that because it just doesn't work
this is what i tried:
loadVariablesNum("nummer.txt",1);
trace(_root.nummer);
and it still gives undefined
does it work with you or am i that stupid?? :)
farafiro
09-18-2002, 11:58 AM
well, if the variable which is in the text file's name is nummer
this should work
r u in MX or 5??
safirjunk
09-18-2002, 12:19 PM
running MX
i tested it again and when i run the debugging method i can see the variable nummer in the variable section with the number 6 in it. So it seems i can't proparly call up a variable.
Does it work with you??
farafiro
09-18-2002, 12:49 PM
I didn't try it the way u do but try thisfor(i=0;i<=Number(_root.number);i++)
safirjunk
09-18-2002, 01:10 PM
still undefined
there must be sth i'm doing wrong i guess
farafiro
09-18-2002, 01:24 PM
post your files here pls
safirjunk
09-18-2002, 02:01 PM
here you go
thanks for helping me out
if you do:
loadVariablesNum("nummer.txt",1);
the variables are not on the _root level (thats _level0) they are on _level1.
as a test try this:
//frame 1
loadVariablesNum("test.txt",1);
//frame 2
//this frame is blank
//frame3
//create a loop that will pause the movie until the file is loaded:
if(_level1.test==undefined){
gotoAndPlay(2);
}
trace(_level1.test);
stop();
now the txt file looks like this:
&test=this is a test&
give it a go, and you see your value come up just fine.
switch _level1 to _root, it comes up undefined.
safirjunk
09-18-2002, 02:57 PM
thanks, it finally works
thanks for helping
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.