Monday, December 28, 2009

In ActionScript I got 5 labels named x1 -> x5. How do I assign values with a loop not creating array ?

I tried this:


for (i = 1; i %26lt; 6; i++) {


x[i].text = i;


}





Not working though.In ActionScript I got 5 labels named x1 -%26gt; x5. How do I assign values with a loop not creating array ?
Try the following


for (i = 1; i %26lt; 6; i++) {


lab=eval(';_root.x';+i);


lab.text=i;


}

No comments:

Post a Comment