简体   繁体   English

如何将字符串作为变量actionscript 2传递

[英]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? 我将如何使用Actionscript 2这样做呢?

Try this : 试试this

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM