View Full Version : incremented variables??
Uli
January 14th, 2004, 10:02 PM
Hello,
I was wondering if there a way to check if a variable(x) exist..
Let me try to explain a bit more:
Let's pretend i load 5 variables from a text file named myvariable1 , myvariable2, ... , myvariable5
How can i check if "myvariable(x)" = true where x = 1 or 2 or 3 ... as they were incremented..??
Does that make sens? Any ideas?
Thanks =)
GreenLantern
January 14th, 2004, 11:02 PM
Arrays, my friend, arrays.
Try searching around for a while. If you no luck doing that, post here and I will do my best to give you some help.
lostinbeta
January 14th, 2004, 11:19 PM
Do you mean like this? myVariable1 = true;
myVariable2 = false;
myVariable3 = true;
myVariable4 = false;
myVariable5 = true;
for (var i = 1; i<=5; i++) {
trace(this["myVariable"+i]);
} ??? If so, it's basic associative array referencing :) I could go into it here, but Senocular already did a fantastic job explaining it in another thread, you can find a link to that thread in a thread called "Best Of Senocular"... run a search for it (be sure to check the "Search Titles Only" radio button in the search page before you run the search).
Uli
January 14th, 2004, 11:26 PM
Not sure...
Let's pretend i load a txt file and in that txt file i have the variable &numberofvariables = 10. So i duplicated 10 times some variable like ["myvariable"+i]. This is all good...
The hard part is: I have a duplicated movie clip for each variable in which i have a button. If that button is pressed, the variable in relation with that button (still ["myvariable+i"]) is true, otherwise, it's false.
Now i wanna be able to test who is false and who is true.
Uli
January 15th, 2004, 02:16 AM
hmm i got it now...
In fact i got myself confused LOL!! I even did that before!! Anyway thanks guyz, you put me back on track somehow :D :D
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.