 # If Then Else alternative

Hi guys,

I made a script which will tile dynamic mc in a way that after a number of clips (say 5) in a row, i would like the 6th mc to position on the next row below the first row, like this:

1 2 3 4 5
6 7 8 9 10

i was able to do it thru series of if-else if statements but the thing is that i was wondering if there’s a better logic in doing this, i was thinking of using switch statement but is there a way to type “i>=9 && i<=20” into a case parameter? here is the code and i have also attached the fla if anyone would like to see:

``````
if (i>=20 && i<=25) {
item._x = item._width+275;
yVal = (i-20)*(item._height+5);
item._y = yVal;
trace(yVal);
}
else if (i>=15 && i<=19) {
item._x = item._width+185;
yVal = (i-15)*(item._height+5);
item._y = yVal;
trace(yVal);
} else if (i>=10 && i<=14) {
item._x = item._width+95;
yVal = (i-10)*(item._height+5);
item._y = yVal;
trace(yVal);
} else if (i>=5 && i<=9) {
item._x = item._width+5;
yVal = (i-5)*(item._height+5);
item._y = yVal;
trace(yVal);
} else {
yVal = i*(item._height+5);
item._y = yVal;
trace(yVal);
}

``````

Thanks for help!

_ScriptRookie