is it possible to dynamically create variables in actionscript?
for example lets say i have some kind of loop and for each itteration of loop i want new variable to be created, or acssed if creatin is not possible. ( tbh i don’t need to create them dynamically there is more simple sollution of my problem in real project, am just wandering is it possible )
this is what i have tried for creating but it doesnt work:
(it also doesnt work if i add [“number”+i] ) instead of (“number”+i)
for(var i:int=0; i<9; i++){
var ("number"+i):int = i ;
trace(("number"+i));
}
this is for acessing also doesnt work:
var number1:int = 0;
var number2:int =29;
var number4:int = 36;
.....
for(var i:int=0; i<9; i++){
trace(("number"+i));
}
the best i could thought for acessing is filling them in array and acessing it like that… code works but i am actually trying to make it work without array
var var1:int= 0;
var var2:int= 290;
var var3:int= 59;
var array:Array = [var1,var2,var3]
for(var i:int=0; i<9; i++){
trace(array*);
}