Array Button Menu that changes MovieClips with Tweener

OK.
So I’ve been trying the last couple of days to make 2 different codes i had into one…

The first on is using the Tweener class and everytime that I press a button it fades out the loaded content of the previous selection, waits for it to finish and then loads the content of the button pressed. Everything works fine with this part.

The second code is the on that is using an Array to dynamicaly rollover, rollout and keep selected the buttons.
It was also changing the content of the mc that everything is loaded on but without this fancy fade in - fade out…!!

So i think its time for some code now…:

import mx.transitions.*;
import mx.transitions.easing.Strong;

var FADEINSTART:Number = 2;
var FADEINSTOP:Number = 7;
var FADEOUTSTART:Number = 10;
var FADEOUTSTOP:Number = 15;


var groupinfo:Array = [
    {mc:about, toload:"mcHome"},
    {mc:service, toload:"mcService"},
    {mc:contact, toload:"mcContact"}];

var activebtn:MovieClip;
var holder1:MovieClip = _root.attachMovie("mcHome", "mcMain", 10);
holder1._x = 0;
holder1._y = 110;



function doRollOver() {
   if (this != activebtn) {
        if (this._currentframe>FADEOUTSTART && this._currentframe<FADEOUTSTOP) {
            this.gotoAndPlay(FADEINSTART+FADEOUTSTOP-this._currentframe);
        } else {
            this.gotoAndPlay(FADEINSTART);
        }
        var my_sound:Sound = new Sound();
        my_sound.attachSound("sndOver");
        my_sound.start();
    }
}

function doRollOut() {
   if (this != activebtn) {
        if (this._currentframe>FADEINSTART && this._currentframe<FADEINSTOP) {
            this.gotoAndPlay(FADEOUTSTART+FADEINSTOP-this._currentframe);
        } else {
            this.gotoAndPlay(FADEOUTSTART);
        }
    } 
}    

function doClick() {
    
    trace ("---------vars after click----------")
    trace ("activebtnStart  "+  activebtn);
    
    //this part it is where the tweening should happen...
    if (this != activebtn){
        var mcTween:Tween = new Tween(mcMain, "_alpha", Strong.easeOut, 100, 0, 1, true);
        mcTween.onMotionFinished = function() {
            var holder2:MovieClip = _root.attachMovie(this.p, "mcMain2", 10); 
            holder2._x = 0;
            holder2._y = 110;
            holder2.alpha = 0;
            var mcTween2:Tween = new Tween(mcMain2, "_alpha", Strong.easeOut, 0, 100, 1, true);
        }
    }
    
    var prevbtn:MovieClip = activebtn;
    activebtn = this;
    this.gotoAndStop(FADEINSTOP);
    prevbtn.onRollOut();

    trace ("this.p  "+  this.p);
    trace ("this  "+  this);
    trace ("prevbtn  "+  prevbtn);
    trace ("activebtn  "+  activebtn);

    
}


function init() {
   for (var element in groupinfo) {  
      // btn is a pointer to one of the nav buttons
      var btn:MovieClip = groupinfo[element].mc;

      
      // have each button remember which mc it is supposed to load
      btn.p = groupinfo[element].toload;
      
      // assign functions to each event
      btn.onRollOver = doRollOver;
      btn.onRollOut = doRollOut;
      btn.onRelease = doClick;
      
      
      trace ("element   " + element);
      trace ("groupinfo[element].toload  " + groupinfo[element].toload);
      trace ("btn  " + btn)
      trace ("btn.p  " + btn.p);
      trace ("-------------next element--------------")
    }
}

init();

you can have a look at the swf here…

Ive managed to make the previous mc to fade out but cant really make everything work properly…!!!

Ive also used quite a few traces cause i couldnt really understand what those btn.p and that .p in general is…!!
(why does this guy uses this .p and what it really is!?)
The code for the buton group i got it from here…

Please could someone help me with this thing!!
I think its a great piece of dynamic code if we can eventualy make it work properly!! :sonic:

Thanksss!!!