# Creating a grid in code

**URL:** <https://forum.kirupa.com/t/creating-a-grid-in-code/64555>\
**Category:** Uncategorized\
**Created:** [September 17, 2004, 1:26pm UTC](https://forum.kirupa.com/t/creating-a-grid-in-code/64555 "2004-09-17T13:26:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trolley](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@trolley](https://forum.kirupa.com/u/trolley)\
**Post date:** [September 17, 2004, 1:26pm UTC](https://forum.kirupa.com/t/creating-a-grid-in-code/64555/1 "2004-09-17T13:26:14Z")

</div>

Recently someone posted me this code:  
MovieClip.prototype.drawCircle = function(r,x,y) {  
this.moveTo(x+r, y);  
a=Math.tan(22.5_Math.PI/180);  
for (var angle = 45; angle\<=360; angle +=45){  
var endx = r_Math.cos(angle&Math.PI/180);  
var endy = r_Math.sin(angle&Math.PI/180);  
var cx = endx+r_a_Math.cos((angle-90)Math.PI/180);  
var cy = endy+ra_Math.sin((angle-90)\*Math.PI/180);  
this.curveTo(cx+x, cy+y, endx+x, endy+y);  
}  
};  
circles\_mc = \_root.createEmptyMovieClip(“circles\_mc”, 0);

circles\_mc.\_x = 0;  
circles\_mc.\_y = 0;

for (var i=0; i \<144; i++) {  
c\_mc = \_root.circles\_mc.createEmptyMovieClip(“c”+i+"\_mc", i);  
c\_mc.beginFill(“0x000000”, 100);  
c\_mc.lineStyle(0, “0x000000”, 100);  
c\_mc.drawCircle(2.5, 3.75, 3.75);  
c\_mc.endFill();

```
c_mc._x = i*7.5;
c_mc._y = 0;
while (c_mc._x &gt;82.5) {
	c_mc._x -= 90;
	c_mc._y += 7.5;
}

```

}

it works, but I want to

1. change the diameter of the circle to 5px
2. change the spacing so that there is a 2px gap between each circle
3. make it 100 circles wide x 100 circles high

Please help!

p.s. apologies to the person who originally poste the above code - I can’t find the original thread!
