Basic Accordion Menu Code Help

Hi, I must say I’m pretty new to AS3.0 and last night I tried to develop this accordion menu. It’s not XML driven nor does it use AS3.0 to create each “button”. What I did was create individual “menus”, basically like drop down menus, and converted them into separate movieClips. Also inside of them there’s a button movieClip which is the larger one that opens the menu (instanced “btn”), a reference movieClip called tabHeight to define its height - since it can depend on the number of “sub-menus” you have - and a tabMask that onClick (is supposed) to open and reveal the “sub-menus” while making everything move according to that change.
I want it to basically start with all menus closed and onClick it reveals each menu, making the necessary y movements.

Well I think I have the code pretty much done, however I am getting some errors and I can’t make it to work.
I’ll post both the code individually and attach the test.fla just in case someone wants to give a direct hand.
It’s a lot easier to understand if you get to download the attachment at the end of this post, you’ll get how I’ve set it up and what my intentions are just by looking at the *.fla. The only thing left to work now is the code :frowning:


var growingTab:Object;
var reducingTab:Object;

var tabArray:Array = [tab_0, tab_1, tab_2, tab_3];

for (var i:int = 0; i < tabArray.length; i++) {
        
    var tab = tabArray*;
    var tabBtn = tabArray*.btn;
    
    tabBtn.num = i;
    trace(tab.name, tabBtn.num);
    
    tabBtn.addEventListener(MouseEvent.CLICK, on_click);
        
}

function on_click(e:MouseEvent):void {
    
    var tabBtn = e.currentTarget;
    var num = tabBtn.num;
    
    trace(num);
    
    if (growingTab != null) {
        setReducing( growingTab );
    }
    
    setGrowing ( num );
            
    addEventListener(Event.ENTER_FRAME, renderTabs);

}

function setGrowing ( num ) {
    
    var growingTab = tabArray[num];
    
}

function setReducing ( obj:Object ) {
    
    var reducingTab = obj;
    
}

function renderTabs(event:Event):void {
    
    growingTab.tabMask.height = growingTab.tabHeight.height;
    
    reducingTab.tabMask.height = 0;
    
    for (var i:int = 0; i < tabArray.length; i++) {
        
        tabArray[i+1].y = tabArray*.y + tabArray*.tabMask.height + (tabArray*.btn.height * i) + 1;
        
    }

}

Thanks in advance for your help!
T