Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load variables

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I tried to load variables from a txt file, and did it, like i always do. the variable in the txt file is:
x=1+1
When i load it, flash returns 1+1, but it should return 2.
Normally i have to mark it as an expressior, but dont know how to do it in a txt file.
So, is it possible and if it is, how?

Thanx
 
Its just an example,

i mean, x= y + 1, and y should be modified by a php file,
so flash returns 2 if y=1 and 3 if y=2.
 
Well... Might be wrong, but seems to me the text file won't make the calculation. You should load the y variable, and make your calculations in Flash!

old.gif
 
thats the problem, if i make it like this:
x=1
and load x to flash,
and write y=x+1 (expressior)
flash returns in the box(for y) 1,
because it thinks that x(1) in the text file is a word and so it counts 0+1(0 for x).
I must have the 1 as x in the txt file, because it should be modified by a php file to x=2 or x=3.

I thought, that there is a way to show flash, that x isnt a word and can be added to the 1 by marking it somehow in the txt file.
 
flash cant make this calculation, at least i dont know how to make flash calucate this
 
loadVariablesNum ("calc.txt", 0);
//where calc.txt contains x=1
answer = number(x)+4;

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
ps: 'answer' outputs as 5 davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Thats what im talking about,
i tried this code:
copied it in my first and only frame, wrote x=1 in calc.txt,
it didnt work, still thinks, that x is a word and counts 0+4=4
in the box for answer it returns 4, not 5
 
Home700,
Just tried it again & you're right... Doesn't seem to work if you just write an actionscript on the first & only frame of your movie. But it works great, if you use the same action on a 2 frame button's press! Curious! And you may not want to use a button... But it's astep forward!
old.gif
 
no, its ok, i use a button, i used a 1 framed button, and it didnt work.
Now it works, it was because of the loading time flash needs.
I wrote an if funktion, if x is ""(empty) go to last frame, if x is loaded go to next frame.
Now it works fine, but still some problems with loading my php files.
 
what's your PHP problem? dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
i have this y variable now(value=2), for example, it should be passed to a oho file, the php file is correct,
it modifies the txt file, from where x is loaded,
with the value of y, but somewhere there is a problem anfd flash passes 0 for y to the php file, but shows 2 for y in the box for y.
Think another problem with the loading time, think, that the php file is starting earlier, than the value for y can be counted.
 
so are you saying that the text file intitiall says:

x=1

And in the Flash movie, y=x+1.
Then you use a PHP script to rewrite the text file as:

x=2

Did I understand your post correctly?

dave dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
yes, thats how it works, i found the problem, i can load x(1) from the txt file on my pc, but it doesnt work on the server, its exactly the same swf file im using on my pc and on the server, but on the server x is 0 again, and 0+1=1 is passed to the php file, so the php file alway writes x=1
into the text file, and nothing works,
i have no idea why its working on my PC and isnt working on the server.
 
what's the PHP code you're using, I'll give it a test on my server?

dave dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top