# Problem with delay

**URL:** <https://forum.kirupa.com/t/problem-with-delay/217526>\
**Category:** Uncategorized\
**Created:** [February 27, 2007, 6:36pm UTC](https://forum.kirupa.com/t/problem-with-delay/217526 "2007-02-27T18:36:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![invisible7](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@invisible7](https://forum.kirupa.com/u/invisible7)\
**Post date:** [February 27, 2007, 6:36pm UTC](https://forum.kirupa.com/t/problem-with-delay/217526/1 "2007-02-27T18:36:41Z")

</div>

I have added a delay function (grabbed from somewhere on the forums) to my buttons to allow a bounce action to catch up, but when stress testing they can get “stuck” on a specific frame. That is to say, if you switch back and forth quickly from btn\_1 to btn\_2 the content will get stuck at one button. At the moment the first action clears the previous frame by going to an empty one, then a deley, and finally proceeeding to the destination frame.

Any help greatly appreciated.

//example button  
mission.onPress = function () {  
\_root.text.gotoAndStop (“start”);  
stop();  
mi = setInterval(function () {  
\_root.text.gotoAndStop (“mission”);  
play();  
clearInterval(mi);  
}, 1000);

```
updateAfterEvent();

```

}
