Hi. I don’t have a lot of AS3 experience and could really do with some help.
I have a Flash poetry project in which I have 49 separate dynamic text boxes on stage. Each has a separate instance name - “cell_1”, “cell_2”, “cell_3” etc. I use the following code to store instance names in an array -
var j:int;
for (j = 1; j < 50; j++) {
instances.push(“cell_”+j)
trace(instances[j]);
}
What I’m trying to do is use a loop in which a single random number is generated, converted to an ASCII character and then displayed in successive text boxes. So basically there’ll be a random letter in each box. Here is the code for that.
for (var i:int; i < 50; i++) {
var rnd:Number = Math.round(Math.random()*25)+65;
var str="";
str += String.fromCharCode(rnd);
cell_1.text = str;
The problem I have is that I want to be able to index the “instances” array to get the instance name and then use it in the “cell_1.text = str” part of the loop rather than have to do the process 49 separate times. So it’ll be something like “instances*.text = str”. I just can’t figure out how to do it and would appreciate any help from more experience programmers.
Thanks,
David