Basic code problem - (for loop)

I know its a simple problem, but i cant figure it out

for (i=1; i<6; i++) {
	sItem = ("s"+i);
	sItem._x = Math.random((bR._x), (tL._x))*(bR._x);

where my mc’s are s1…s5

~ Lacuna aka Seretha :love:

for (i=1; i<6; i++) {
sItem = (“s”+i);
this[sItem]._x = Math.random((bR._x), (tL._x))*(bR._x);
note the brackets
you need them so flash thinks it’s a variable instead of an actual name "sItem"
in fact save a line and put
for (i=1; i<6; i++) {
this[“s”+i]._x = Math.random((bR._x), (tL._x))

supurb. :smiley:

:blush: thanks.