is it possible to assign a value to variables using a for loop?
without using a “for loop”, this is how it would usually be done…
var stringOne:String;
var stringTwo:String;
var stringThree:String;
stringOne = "first..";
stringTwo = "second...";
stringThree = "third...";
trace(stringOne, stringTwo, stringThree); // traces "first.. second... third..."
in an attempt to assign a value to the variables using a “for loop”, this is how the code could be written…
var stringOne:String;
var stringTwo:String;
var stringThree:String;
var stringArray:Array = [stringOne, stringTwo, stringThree];
var stringDefs:Array = ["first..", "second...", "third..."];
for (var i:int = 0; i < stringArray.length; i++)
{
stringArray* = stringDefs*;
}
trace(stringOne, stringTwo, stringThree); // traces "null null null"
doesn’t work…
any solutions?
i need to be able to assign a value to the variables automatically… otherwise i’m going to have to do it the manual way…