AS3--How to concatenate name with for-loop index
Posted on 2011-02-20
This is my code:
["mcText" + i].text = IntroWords;
mcText1 (for example) is a MC of a dynamic text box.
I can do this: trace("mcText" + i); and I get mcText1, mcText2, etc. So it looks like it will concatenate the two.
I get this syntax error: "expecting identifier before dot.", though, when I put it together like this: ["mcText" + i].text = IntroWords;
If, however, I just go with mcText2.text = IntroWords, it passes and works fine.
There is something wrong with trying to concatenate the name with the for-loop index while adding the .text behind it.
I'm old at AS2 but new at AS3.
Thanks for a thorough answer. (I know very little about classes, imports, etc. at this point.)