# getNextHighestDepth

**URL:** <https://forum.kirupa.com/t/getnexthighestdepth/248272>\
**Category:** Uncategorized\
**Created:** [January 6, 2008, 11:03am UTC](https://forum.kirupa.com/t/getnexthighestdepth/248272 "2008-01-06T11:03:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darlo\_scott](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@darlo\_scott](https://forum.kirupa.com/u/darlo_scott)\
**Post date:** [January 6, 2008, 11:03am UTC](https://forum.kirupa.com/t/getnexthighestdepth/248272/1 "2008-01-06T11:03:04Z")

</div>

Hi

I followed the XML drop down tutorial and managed to get the system working fine, however when I have applied this method to my own project I have found a problem.

The original tutorial uses a depth of 0 when creating the menu item:

var curr\_menu = container.createEmptyMovieClip(name, depth);

This means the menu items were being placed under another movieclip which is being created programmatically.

My solution was to replace the original depth with getNextHighestDepth:  
var curr\_menu = container.createEmptyMovieClip(name, this.getNextHighestDepth());

This appeared to work fine,the menu now appeareed above the other movieclip, until I realised the menu rollovers wouldn’t work after loading the menu a number of times (I load the menu onRelease of a button).

Any help would be much appreciated.

Scott
