How does one designate an array to an object?

I’m an AS3 newbie so bare with me here.

I am working on a page of my portfolio in which there are four menu items (buttons): Print, Identity, Packaging and Other. When you click on any one of these, they successfully turn and display their subsequent sub sub navigation.

I chose the smallest menu item “Identity” to start with (I haven’t touched the other buttons yet). The sub sub navigation button is a movie clip and I have an array that I got from a template online so that when you click on a menu item, that item stays down until you push another one etc.

Currently in my code the sub sub navigation movieclip “mcIdentityButtons” appears but I can’t figure out what to do with the array coding. The array works if I put it directly into the mcIdentityButtons AS but I would like to put it on the main timeline. Basically, I can’t figure out how to tell the computer to know that the Array is for the mcIdentityButtons and the following array items (mcIdentityA, mcIdentityB etc) are already instances within mcIdentityButtons.

Specific coding is in blue:

import fl.transitions.Tween;
import fl.transitions.easing.*;

stop();

//Sub Navigation Variables for x & y coordinates

var btnPrintX:Number = 133.3;
var btnPrintY:Number = 220;

var btnIdentityX:Number = 133.3;
var btnIdentityY:Number = 337.1;

var btnPackagingX:Number = 133.3;
var btnPackagingY:Number = 476.4;

var btnOtherX:Number = 133.3;
var btnOtherY:Number = 559;

//Sub Navigation Buttons to Stage and Positioning

var btnPrint:btnPrintClass = new btnPrintClass();
addChild(btnPrint);
btnPrint.x = btnPrintX;
btnPrint.y = btnPrintY;

var btnIdentity:btnIdentityClass = new btnIdentityClass();
addChild(btnIdentity);
btnIdentity.x = btnIdentityX;
btnIdentity.y = btnIdentityY;

var btnPackaging:btnPackagingClass = new btnPackagingClass();
addChild(btnPackaging);
btnPackaging.x = btnPackagingX;
btnPackaging.y = btnPackagingY;

var btnOther:btnOtherClass = new btnOtherClass();
addChild(btnOther);
btnOther.x = btnOtherX;
btnOther.y = btnOtherY;

// Vertical varibles to replace sub navigation buttons when clicked

var mcPrintVert:mcPrintVertClass = new mcPrintVertClass();
var mcIdentityVert:mcIdentityVertClass = new mcIdentityVertClass();
var mcPackagingVert:mcPackagingVertClass = new mcPackagingVertClass();
var mcOtherVert:mcOtherVertClass = new mcOtherVertClass();

// Sub sub navigation variables and coordinates

var mcPrintButtons:mcPrintButtonsClass = new mcPrintButtonsClass();
var mcIdentityButtons:mcIdentityButtonsClass = new mcIdentityButtonsClass();
var mcPackagingButtons:mcPackagingButtonsClass = new mcPackagingButtonsClass();
var mcOtherButtons:mcOtherButtonsClass = new mcOtherButtonsClass();

mcPrintButtons.x = 168.3;
mcPrintButtons.y = 150.3;

mcIdentityButtons.x = 168.3;
mcIdentityButtons.y = 227.1;

mcPackagingButtons.x = 168.3;
mcPackagingButtons.y = 345.8;

mcOtherButtons.x = 168.3;
mcOtherButtons.y = 485.3;

// Mouse events for sub navigation

btnPrint.addEventListener(MouseEvent.MOUSE_DOWN, btnPrintDownHandler);

function btnPrintDownHandler(Evt:MouseEvent):void {
if (!btnIdentity.stage) {
removeChild(mcIdentityVert);
addChild(btnIdentity);
btnIdentity.x = btnIdentityX;
btnIdentity.y = btnIdentityY;
}
if (!btnPackaging.stage) {
removeChild(mcPackagingVert);
addChild(btnPackaging);
btnPackaging.x = btnPackagingX;
btnPackaging.y = btnPackagingY;
}
if (!btnOther.stage) {
removeChild(mcOtherVert);
addChild(btnOther);
btnOther.x = btnOtherX;
btnOther.y = btnOtherY;
}
if (mcIdentityButtons.stage) {
removeChild(mcIdentityButtons);
}
if (mcPackagingButtons.stage) {
removeChild(mcPackagingButtons);
}
if (mcOtherButtons.stage) {
removeChild(mcOtherButtons);
}
addChild(mcPrintVert);
mcPrintVert.x = 136.2;
mcPrintVert.y = 224.7;
removeChild(btnPrint);
addChild(mcPrintButtons);
var mcPrintButtonsTween:Tween = new Tween(mcPrintButtons,“alpha”, null, 0, 1, 1, true);
}

[COLOR=Blue]btnIdentity.addEventListener(MouseEvent.MOUSE_DOWN, btnIdentityDownHandler);

function btnIdentityDownHandler(Evt:MouseEvent):void {
if (!btnPrint.stage) {
removeChild(mcPrintVert);
addChild(btnPrint);
btnPrint.x = btnPrintX;
btnPrint.y = btnPrintY;
}
if (!btnPackaging.stage) {
removeChild(mcPackagingVert);
addChild(btnPackaging);
btnPackaging.x = btnPackagingX;
btnPackaging.y = btnPackagingY;
}
if (!btnOther.stage) {
removeChild(mcOtherVert);
addChild(btnOther);
btnOther.x = btnOtherX;
btnOther.y = btnOtherY;
}
if (mcPrintButtons.stage) {
removeChild(mcPrintButtons);
}
if (mcPackagingButtons.stage) {
removeChild(mcPackagingButtons);
}
if (mcOtherButtons.stage) {
removeChild(mcOtherButtons);
}
addChild(mcIdentityVert);
mcIdentityVert.x = 136.4;
mcIdentityVert.y = 343.2;
removeChild(btnIdentity);
addChild(mcIdentityButtons);
var mcIdentityButtonsTween:Tween = new Tween(mcIdentityButtons,“alpha”, null, 0, 1, 1, true);

//---- add the buttons to an array --------

var buttonsArray:Array = [mcIdentityA,mcIdentityB,mcIdentityC,mcIdentityD,mcIdentityE];

//----loop thru the buttonsArray-----
//----set some properties and add events to buttons----
function setButtons():void {
for (var i:int=0; i<buttonsArray.length; i++) {
buttonsArray*.id = i;
buttonsArray*.buttonMode = true;
buttonsArray*.mouseChildren = false;
buttonsArray*.mouseEnabled = true;
buttonsArray*.addEventListener(MouseEvent.ROLL_OVER,playOver);
buttonsArray*.addEventListener(MouseEvent.ROLL_OUT,playOut);
buttonsArray*.addEventListener(MouseEvent.CLICK,doClick);
}
}
//----fires when the mouse rolls over the button----
function playOver(event:MouseEvent):void {
event.currentTarget.gotoAndPlay(“over”);
}
//----fires when the mouse rolls out the button----
function playOut(event:MouseEvent):void {
event.currentTarget.gotoAndPlay(“out”);
}
//----fires when you click on the button
function doClick(event:MouseEvent):void{
//----set the currentBtn variable equal with-----
//----the id of the button that was clicked-----
var currentBtn:int = event.currentTarget.id;
//----call the setSelectedBtn function
setSelectedBtn(currentBtn);
}
/check to see witch button was clicked
if the id passed to the setSelectedBtn function
is identical with the id of the button clicked
we put that buttons in the down state (selected)
and remove all the events added to it
/
function setSelectedBtn(id:int):void{
for (var i:int=0; i< buttonsArray.length; i++) {
if (id == i) {
buttonsArray*.gotoAndStop(“down”);
buttonsArray*.buttonMode = false;
buttonsArray*.mouseEnabled = false;
buttonsArray*.removeEventListener(MouseEvent.ROLL_OVER,playOver);
buttonsArray*.removeEventListener(MouseEvent.ROLL_OUT,playOut);
buttonsArray*.removeEventListener(MouseEvent.CLICK,doClick);
} else {
if(buttonsArray*.currentLabel ==“down”){
buttonsArray*.gotoAndPlay(“out”);
}
buttonsArray*.buttonMode = true;
buttonsArray*.mouseEnabled = true;
buttonsArray*.addEventListener(MouseEvent.ROLL_OVER,playOver);
buttonsArray*.addEventListener(MouseEvent.ROLL_OUT,playOut);
buttonsArray*.addEventListener(MouseEvent.CLICK,doClick);
}
}
}
//----call the setButtons function----
setButtons();
}[/COLOR]

btnPackaging.addEventListener(MouseEvent.MOUSE_DOWN, btnPackagingDownHandler);

function btnPackagingDownHandler(Evt:MouseEvent):void {
if (!btnPrint.stage) {
removeChild(mcPrintVert);
addChild(btnPrint);
btnPrint.x = btnPrintX;
btnPrint.y = btnPrintY;
}
if (!btnIdentity.stage) {
removeChild(mcIdentityVert);
addChild(btnIdentity);
btnIdentity.x = btnIdentityX;
btnIdentity.y = btnIdentityY;
}
if (!btnOther.stage) {
removeChild(mcOtherVert);
addChild(btnOther);
btnOther.x = btnOtherX;
btnOther.y = btnOtherY;
}
if (mcPrintButtons.stage) {
removeChild(mcPrintButtons);
}
if (mcIdentityButtons.stage) {
removeChild(mcIdentityButtons);
}
if (mcOtherButtons.stage) {
removeChild(mcOtherButtons);
}
addChild(mcPackagingVert);
mcPackagingVert.x = 136.1;
mcPackagingVert.y = 482.4;
removeChild(btnPackaging);
addChild(mcPackagingButtons);
var mcPackagingButtonsTween:Tween = new Tween(mcPackagingButtons,“alpha”, null, 0, 1, 1, true);
}

btnOther.addEventListener(MouseEvent.MOUSE_DOWN, btnOtherDownHandler);

function btnOtherDownHandler(Evt:MouseEvent):void {
if (!btnPrint.stage) {
removeChild(mcPrintVert);
addChild(btnPrint);
btnPrint.x = btnPrintX;
btnPrint.y = btnPrintY;
}
if (!btnIdentity.stage) {
removeChild(mcIdentityVert);
addChild(btnIdentity);
btnIdentity.x = btnIdentityX;
btnIdentity.y = btnIdentityY;
}
if (!btnPackaging.stage) {
removeChild(mcPackagingVert);
addChild(btnPackaging);
btnPackaging.x = btnPackagingX;
btnPackaging.y = btnPackagingY;
}
if (mcPrintButtons.stage) {
removeChild(mcPrintButtons);
}
if (mcIdentityButtons.stage) {
removeChild(mcIdentityButtons);
}
if (mcPackagingButtons.stage) {
removeChild(mcPackagingButtons);
}
addChild(mcOtherVert);
mcOtherVert.x = 135.6;
mcOtherVert.y = 563.5;
removeChild(btnOther);
addChild(mcOtherButtons);
var mcOtherButtonsTween:Tween = new Tween(mcOtherButtons,“alpha”, null, 0, 1, 1, true);

}

Any suggestions would be MUCH appreciated!

Thanks!