# Simple Array Help

**URL:** <https://forum.kirupa.com/t/simple-array-help/193498>\
**Category:** Uncategorized\
**Created:** [July 13, 2006, 6:24pm UTC](https://forum.kirupa.com/t/simple-array-help/193498 "2006-07-13T18:24:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![messi](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@messi](https://forum.kirupa.com/u/messi)\
**Post date:** [July 13, 2006, 6:24pm UTC](https://forum.kirupa.com/t/simple-array-help/193498/1 "2006-07-13T18:24:08Z")

</div>

I have 2 ball movieclips named Ball1, Ball2  
I want to store those 2 balls in an array like this  
ballArray = new Array([Ball1, Ball2]);

Then i want to pick the balls from the array and display it on the screen.

totalballs = 20;  
ball1x = 10;  
ball1y = 10;

ball2x = 10;  
ball2y = 10;  
for (var i = 0; i\<totalballs; ++i)  
{  
var ball1name = “Balla1”+;  
var ball2name = “Ballb1”+i;

\_root.attachMovie(“Ball1”, ball1name, i); //Here instead of “Ball1” what should put to pick the ball from the array “ballArray”  
\_root.attachMovie(“Ball2”, ball2name, i); //Here instead of “Ball1” what should put to pick the ball from the array “ballArray”

\_root[ball1name].\_x = ball1x;  
\_root[ball1name].\_y = ball1y;

\_root[ball2name].\_x = ball2x;  
\_root[ball2name].\_y = ball2y;

//I donno if this is correct i want to lace the new balls next to each other in the row and the column.  
ball1x++;  
ball1y++;  
ball2x++;  
ball2y++;  
}

Please any of these AS experts help me out.  
Ash.
