Child Index - drop down menu shows up BEHIND content on stage instead of ON TOP

[SIZE=1]Child Index - drop down menu shows up BEHIND content on stage instead of ON TOP of content[/SIZE]

[SIZE=1]Hi all,

I’m using Flash CS4 and trying to set up a Flash site using AS3, based on the tutorial, “Building Websites in Flash CS3” with Craig Campbell.

My issue is that my drop down menu is showing up BEHIND the content on the stage instead of ON TOP of it, thus making it inaccessible to mouse events. (The content on the stage contains movie clips that load onto the stage when a button movie clip is clicked.)

This is the error message I get: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

-----------------------This is the code I’m using:----------------------------------------------

var currentPage:MovieClip = home_mc; //set the current page to the home pg

home_mc.gotoAndStop(“down”);

//----create new instance of of ech pg from existing library symbol (ex. homePage) and set the new instance’s linkage id (ex. pageHome)----
var homePage:pageHome = new pageHome();
var partsPage:pageParts = new pageParts();
partsPage.stop();
var salesPage:pageSales = new pageSales();
salesPage.stop();
var showroomPage:pageShowroom = new pageShowroom();
showroomPage.stop();
var careersPage:pageCareers = new pageCareers();
careersPage.stop();
var aboutPage:pageAbout = new pageAbout();
aboutPage.stop();

//----tie ech menu btn mc to their corresponding pg (target.MC is an arbitrary name)----
home_mc.targetMC = homePage;
parts_mc.targetMC = partsPage;
sales_mc.targetMC = salesPage;
showroom_mc.targetMC = showroomPage;
careers_mc.targetMC = careersPage;
about_mc.targetMC = aboutPage;

//THIS IS THE PART CAUSING THE ERROR MSG #2025 (trying to get this to work to ensure dropdown mnu is above any pages loaded onto the stage)****
var pageIndex = getChildIndex(currentPage.targetMC);
setChildIndex(parts_mc.dropdown_mc, pageIndex + 1);

//----set placement for mc pg on stage----
homePage.x = 0;
homePage.y = 271;
partsPage.x = salesPage.x = showroomPage.x = careersPage.x = aboutPage.x = 0
partsPage.y = salesPage.y = showroomPage.y = careersPage.y = aboutPage.y = 164

//----add homePage obj to stage at beginning of website load----
addChild(homePage);

var btnMCList:Array = [home_mc,parts_mc,parts_mc.dropdown_mc.smParts_mc,
sales_mc,showroom_mc,careers_mc,about_mc];

for (var i:uint = 0; i < btnMCList.length; i++)
{
btnMCList*.buttonMode = true; //----turn on btn mode for btn mc’s----
btnMCList*.addEventListener(MouseEvent.ROLL_OVER, mOver); //----MOUSE OVER btn mc events - add event listeners----
btnMCList*.addEventListener(MouseEvent.ROLL_OUT, mOut); //----MOUSE OUT btn mc events - add event listeners----
btnMCList*.addEventListener(MouseEvent.CLICK, newPage); //----MOUSE CLICK event - add event listeners----
}

//----set to false, in order to eliminate hand cursor upon site load----
home_mc.buttonMode = false;

function mOver(e:MouseEvent):void
{
if (currentPage != MovieClip(e.currentTarget)){ //----compare currentPage to targeted btn mc----
e.currentTarget.gotoAndPlay(“over”);
e.currentTarget.addEventListener(MouseEvent.ROLL_OUT, mOut);
}
}

function mOut(e:MouseEvent):void
{
if (currentPage != MovieClip(e.currentTarget)){ //----compare currentPage to targeted btn mc----
e.currentTarget.gotoAndPlay(“out”);
}
}

function newPage(e:MouseEvent):void
{
home_mc.buttonMode = true; //----turn home btn mc on after some other btn mc is clicked----

         //----Next, change previously clicked btn mc to "out" state when a new btn mc is clicked----
     if (MovieClip(currentPage).currentLabel =="down"){
         MovieClip(currentPage).gotoAndPlay("out")
 }

removeChild(currentPage.targetMC);    //----remove existing pg----
currentPage = MovieClip(e.currentTarget);    //----set currentPage equal to targeted btn mc----
addChild(currentPage.targetMC);    //----add targeted pg----
currentPage.targetMC.gotoAndPlay(1);    //----refers to timeline of page mc which may have animation----

e.currentTarget.gotoAndStop("down");    //----show "down" state to indicate btn mc has been clicked----
MovieClip(e.currentTarget).buttonMode = false;    //----remove hand cursor from clicked btn mc----

}

Any help or suggestions would greatly appreciated.

Thanks,
Newbie24
[/SIZE]