# Programmatically added gaps between certain menu items

**URL:** <https://forum.kirupa.com/t/programmatically-added-gaps-between-certain-menu-items/300478>\
**Category:** flash\
**Created:** [November 22, 2009, 3:40am UTC](https://forum.kirupa.com/t/programmatically-added-gaps-between-certain-menu-items/300478 "2009-11-22T03:40:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)\
**Post date:** [November 22, 2009, 3:40am UTC](https://forum.kirupa.com/t/programmatically-added-gaps-between-certain-menu-items/300478/1 "2009-11-22T03:40:39Z")

</div>

How can I modify the following code to add 26px space between the 2nd and 3rd item in a vertical menu, and the same added space between the 5th and 6th items?

```auto

var xCoord:int = 100;
var yCoord:int = 10;

function initMenu():void {
    
    for (var i:int = 0; i < menuArray.length; i++) {
        menuText = new TextField;
        menuText.name = "navBttn_" + i;
        menuText.x = xCoord;
        menuText.y = (i * 20) + yCoord;
        }
        
}

```

I’m attaching an image so you can see what I’m talking about. I tried doing some things with a switch statement, but that seemed needless complex and not really programmatic.
