0

Say I have these variables

var word1 ='wordA';
var word2 ='wordB';
var word3 ='wordC';
var word4 ='wordD';
var word5 ='wordE';

and I have this loop

for (var i=1; i<6; i++) {
    // make word + i = ''; (an empty string)
}

how would I go about doing so using Actionscript 2?

user2817200
  • 1,097
  • 2
  • 18
  • 38

1 Answers1

2

Try this:

for (var i=1; i<6; i++) {
    this[ "word" + i ] = ''; (an empty string)
}
Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146
  • Ah, it works. I normally code in Javascript and use $(this) when using Javascript selectors, I find it strange that 'this' in actionscript can be used this way. Interesting.. anyways, thanks. – user2817200 Dec 09 '13 at 15:07