gotoAndPlay(x),x from an Array

Hello guys,

I have a problem, i want to gotoAndStop a movieClip when i RollOver a btn. I have a total of 6btn and my mc has 6 frames. I sad that it is easy to use array’s, so i develop this code (but i see that it is not working :frowning: )! Can somebody help me;

Short description of the code:
BackgroundArray = the array that contains the frame to go to;
SubBtnArray = the array that contains the instancenames for my btns;


var root:MovieClip = this;
var subBtnArray : Array = new Array (_sHome, _sColectii, _sMagazine, _sColectiiPers, _sNews, _sContact);
var BackgroundArray : Array = new Array ("2", "3", "4", "5", "6", "7");
//tried with var BackgroundArray : Array = new Array (2, 3, 4, 5, 6, 7); but no result!
for (var nrBG : Number = 0; nrBG < BackgroundArray.length; nrBG ++)
{
    for (var nrSubBtn : Number = 0; nrSubBtn < subBtnArray.length; nrSubBtn ++)
    {
        subBtnArray [nrSubBtn].onRollOver = function ()
        {
            root._subMeniuBara._alpha = 100;
            root._bg.gotoAndStop (BackgroundArray [nrBG])
            root._subMeniuBara._y = this._y
        }
        subBtnArray [nrSubBtn].onRollOut = function ()
        {
            root._subMeniuBara._alpha = 0;
        }
    }
}

Can somebody help me resolving this?

Thank you in advance, btibia :thumb2: