user2817200
user2817200

Reputation: 1117

how to pass string as variable actionscript 2

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?

Upvotes: 0

Views: 86

Answers (1)

Ivan Chernykh
Ivan Chernykh

Reputation: 42166

Try this:

for (var i=1; i<6; i++) {
    this[ "word" + i ] = ''; (an empty string)
}

Upvotes: 2

Related Questions