# Spacing buttons with loop

**URL:** <https://forum.kirupa.com/t/spacing-buttons-with-loop/179863>\
**Category:** flash\
**Created:** [February 23, 2006, 3:12pm UTC](https://forum.kirupa.com/t/spacing-buttons-with-loop/179863 "2006-02-23T15:12:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coop](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@coop](https://forum.kirupa.com/u/coop)\
**Post date:** [February 23, 2006, 3:12pm UTC](https://forum.kirupa.com/t/spacing-buttons-with-loop/179863/1 "2006-02-23T15:12:35Z")

</div>

Hi all,

More AS woes,

I have a script attachs btns with a loop and places names in them from an array, this all works fine but I need to space them with the loop as well so

[AS]  
clip.\_x = 20  
clip.\_y = 20\*i

[/AS]

this will always start the \_y at 0 cos i in the loop will always start at 0  
Is there a way to start the y at any number and then still place the other btns under it, without putting the btn in a holder movieclip that I then place.

[AS]  
btn\_arr = [" Button one", " Button two", " Button three", " Button four"];  
for (x=0; x\<btn\_arr.length; x++) {  
var clip = this.attachMovie(“btn\_mc”, “btn\_mc”+x, x);  
clip.\_x = 5;  
clip.\_y = 27\*x;  
clip.btn\_txt.text = btn\_arr[x];  
clip.link = link\_arr[x];  
clip.useHandCursor = false;  
clip.onRollOver = function() {  
this.nextFrame();  
};  
clip.onRollOut = function() {  
this.prevFrame();  
};  
}

[/AS]
