How can i generate dynamically this array.
var posX:Array = [0,-20,20,-40,0,40,-60,-20,20,60,-80,-40,0,40,80,-100,-60,-20,20,60,100]
The numbers in the array refer to the x position of the object. I use it to place objects in triangular formation.
0
-20 20
-40 0 40
-60 -20 20 60 etc
Thank you in advance
The first number of each row is the negative of the zero-based-row-index times
d: which is- i * dEach subsequent number in a row exceeds the previous one by
2*d. Hence subsequent numbers = first-element + 2 * d * zero-based-index-within-the-rowWhich is =
- i * d + 2 * d * j=d * (2 * j - i)