Problem with menu active/inactivity

From inside another function wich is building 2 menu’s from XML.


mainMenu.id = i;
mainMenu.onPress = mainPressed;

rightMenu.id = i;
rightMenu.onPress = subPressed;

BUG:
The only thing is that somethimes the menu wont have the right id, and is inactive!

How can i check secure if one is active, and if yes, slide the older Out.


var prevID:Number;
function subPressed() {
    var prevMc:MovieClip = this._parent["rightMenu"+prevID];
    prevMc.enabled = true;
    prevMc._alpha = 50;
//slideOut
    var s:Slide = new Slide(navigation[prevID], 1300);
    s.moveClipTo(200, navigation[prevID]._y, 2);


    this._alpha = 100;
    this.enabled = false;
//slideIn;
    var s:Slide = new Slide(navigation[this.id], 1300);
    s.moveClipTo(5, navigation[this.id]._y, 2);
    prevID = this.id;
}
function mainPressed() {
    var prevMc:MovieClip = this._parent["mainMenu"+prevID];
    prevMc.enabled = true;
    prevMc._alpha = 50;
//slideOut;
    var s:Slide = new Slide(navigation[prevID], 1300);
    s.moveClipTo(200, navigation[prevID]._y, 2);


    this._alpha = 100;
    this.enabled = false;
//slideIn;
    var s:Slide = new Slide(navigation[this.id], 1300);
    s.moveClipTo(5, navigation[this.id]._y, 2);
    prevID = this.id;
}

Thnx in advanced