# Depth/frame Question

**URL:** <https://forum.kirupa.com/t/depth-frame-question/186946>\
**Category:** programming\
**Created:** [April 25, 2006, 3:23pm UTC](https://forum.kirupa.com/t/depth-frame-question/186946 "2006-04-25T15:23:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lord\_Rahl](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@Lord\_Rahl](https://forum.kirupa.com/u/Lord_Rahl)\
**Post date:** [April 25, 2006, 3:23pm UTC](https://forum.kirupa.com/t/depth-frame-question/186946/1 "2006-04-25T15:23:31Z")

</div>

Ok, let me first start by saying my problem. My current problem is: When the main character hits the zombie it activates a script to gotoAndStop(“dead”);. The problem here is that when it gets to the dead frame, the main character and zombie movieclips are still on the screen. I am positive this is due to my depth script because I have removed it and noticed it worked fine. + it makes sense if you think about it. Below is my depth script.

```auto

onClipEvent(enterFrame){
 if(this._y<_root.mainchar._y){
  _root.mainchar.swapDepths(_root.getNextHighestDepth());
 }else if(this._y>_root.mainchar._y){
  this.swapDepths(_root.getNextHighestDepth());
 }
}

```

So I have a few ideas on how I may get around this, but I need some help on two parts.  
1.) I can’t remember how to check if its on a certain frame. So something like “if(onframe=1)”. I’v done this before, I just can’t remember how to do it or find the file I did it in.  
2.) Is there a way to do lowest depth?  
Example: \_root.getLowestDepth() \<------- doesn’t work, just example. :-/
