次の問題があります。
複数の変数を受け取る関数があります。
function test( fooValue:String, foobar1:String, foobar2:String, goobar1:String, goobar2:String ) {
//using the values statically
mytext1.text = foobar1;
mytext2.text = foobar2;
mytext3.text = goobar1;
mytext4.text = goobar2;
if ( goobar1 = "problem" ) {
myProblem.text = this["foo" + fooValue] + this["goo" + fooValue];
}
}
//now here's an example call
test( "bar1","first value ","second value ", "another value", "yet another value");
上記の呼び出しで fooValue に「bar1」があるという事実を考えると、myProblem.text を作成して「最初の値と別の値」を表示するにはどうすればよいですか
this[ "foo" + fooValue] は私に undefined を与えます
- 質問を編集し、より具体的にしようとしました。