# 256 levels of recursion error

**URL:** <https://forum.kirupa.com/t/256-levels-of-recursion-error/219079>\
**Category:** flash\
**Created:** [March 13, 2007, 6:22pm UTC](https://forum.kirupa.com/t/256-levels-of-recursion-error/219079 "2007-03-13T18:22:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dru\_nasty](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dru\_nasty](https://forum.kirupa.com/u/dru_nasty)\
**Post date:** [March 13, 2007, 6:22pm UTC](https://forum.kirupa.com/t/256-levels-of-recursion-error/219079/1 "2007-03-13T18:22:02Z")

</div>

I’ve got the code below working as I’d like, but once my if statement returns true, i get this in the output window:  
256 levels of recursion were exceeded in one action list.  
This is probably an infinite loop.  
Further execution of actions has been disabled in this movie.

The delete this.onEnterFrame triggers and stops the trace from continuing, so I’m not sure why this is happening. On the same note I’d like to know if my script is okay or if there is any “easier” more practical way to write it?  
I like to follow in the footsteps of some of kirupa’s best 😉

```auto
stop();
startTime = getTimer();
bar_mc._width = 0;
onEnterFrame = function() {
	elapsedTime = getTimer()-startTime;
	elapsedSecs = Math.floor(elapsedTime/1000);
	elapsedHun = Math.floor(elapsedTime/100);
	timer_txt = "00:"+elapsedSecs+":"+elapsedHun;
	bar_mc._width = elapsedHun/4;
	if (elapsedSecs >= 40) {
		trace("do stuff here");
		delete this.onEnterFrame();
	}
}

```
