# Building some tabs

**URL:** <https://forum.kirupa.com/t/building-some-tabs/214151>\
**Category:** Uncategorized\
**Created:** [January 25, 2007, 10:46pm UTC](https://forum.kirupa.com/t/building-some-tabs/214151 "2007-01-25T22:46:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deltajam](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@deltajam](https://forum.kirupa.com/u/deltajam)\
**Post date:** [January 25, 2007, 10:46pm UTC](https://forum.kirupa.com/t/building-some-tabs/214151/1 "2007-01-25T22:46:53Z")

</div>

Ok … the skinny:

I have 3 tabs and a mainBox. I would like whatever the active tab is, to be on top of the mainBox, and the rest underneath.

Here’s what I got:

```auto

tabSpacing = 3;
tabBegin = 518.5;
tabDent = 6;
 
tabX = 0;
tabY = 0;
 
var tabs:Array = new Array();
////////////////////////////////
tabs[0] = "Tab 1";
tabs[1] = "Tab 2";
tabs[2] = "Tab 3";
////////////////////////////////
startTab = 1;
////////////////////////////////
 
for (var i = 0; i<tabs.length; i++) {
    chatTab = this.attachMovie("tab", "chatTab" + i, i);
    tabW = chatTab._width - 7.4;
    chatTab._x = tabBegin - (tabW + tabSpacing)*i;
    chatTab._y = 6;
 
    if(startTab == i) {
        chatTab._y = 0;
    }else {
        chatBox.swapDepths(chatTab);
    }
 
}

```

I’m not too sure what I’m doing wrong here … I feel like I’m pretty close though …
