I have the following problem:
I have a function which receives multiple variables:
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");
given the fact that fooValue has "bar1" on the above call, how can I make myProblem.text to display " first value another value"
this[ "foo" + fooValue] gives me undefined
- edited the question and trying to be more specific.