# getNextHighestDepth?

**URL:** <https://forum.kirupa.com/t/getnexthighestdepth/217768>\
**Category:** flash\
**Created:** [March 1, 2007, 7:26pm UTC](https://forum.kirupa.com/t/getnexthighestdepth/217768 "2007-03-01T19:26:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jesirose](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@jesirose](https://forum.kirupa.com/u/jesirose)\
**Post date:** [March 1, 2007, 7:26pm UTC](https://forum.kirupa.com/t/getnexthighestdepth/217768/1 "2007-03-01T19:26:44Z")

</div>

Here is some simple code I am using to try to put two yellow blocks on the screen. I can’t seem to get the getNextHighestDepth function to work. What am I doing wrong here? I have tried using this.getNextHighestDepth() and \_root.getNextHighestDepth(); If I use the blocks number which increments, both show up so they are on different depths, but I’d like to use the automatic number.  
How do I use this function?

```auto

Block = function(shape,x,y){
    this.shape = shape;
    this.clip = _root.attachMovie(shape, "block_"+_root.blocks, this.getNextHighestDepth());
    this.clip._x = x;
    this.clip._y = y;
    _root.blocks++;
    trace(this.clip);
    trace(this.clip._depth);
};
blocks = 1;
b = new Block("block",0,0);
b = new Block("block",35,0);

```

Output:  
\_level0.block\_1  
undefined  
\_level0.block\_2  
undefined
