# SwapDepth and Delay - Stops working after mouse rollover (Flash 8)

**URL:** <https://forum.kirupa.com/t/swapdepth-and-delay-stops-working-after-mouse-rollover-flash-8/292508>\
**Category:** flash\
**Created:** [July 15, 2009, 3:21am UTC](https://forum.kirupa.com/t/swapdepth-and-delay-stops-working-after-mouse-rollover-flash-8/292508 "2009-07-15T03:21:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melza](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Melza](https://forum.kirupa.com/u/Melza)\
**Post date:** [July 15, 2009, 3:21am UTC](https://forum.kirupa.com/t/swapdepth-and-delay-stops-working-after-mouse-rollover-flash-8/292508/1 "2009-07-15T03:21:16Z")

</div>

Hi,

Am really hoping someone can help me - I am sooo close to finishing this project.

I’m still learning Flash, so I hope I explain myself well enough.

I have three buttons, each time you hover over a button an image related to that button will appear. Got this to work by following this tutorial: [[COLOR=#810081]http://www.kirupa.com/developer/actionscript/swapdepth.htm[/COLOR]](http://www.kirupa.com/developer/actionscript/swapdepth.htm)

I have the buttons inside a movieclip and the code on each movie clip is

on (rollOver) {  
\_root.x +=2;  
\_root.But1\_MC.swapDepths(\_root.x);  
}  
on (rollOut) {  
\_root.x += 2;  
\_root.But1\_MC.swapDepths(\_root.x);  
}

I then have each movieclip placed on a seperate frame so that I could add a time delay to each frame i.e.

this.stop();  
pause = function () { play();clearInterval(pausei);};  
pausei = setInterval(pause, 3000);

This works together nicely until I roll my mouse over one of the buttons, and pretty much whatever the last button was that I rolled over that’s what image stays up. The side buttons still keep rotating at the correct interval, but the images are not the correct ones - they get stuck.

Any help is really appreciated.

I have attached a zip file and I’m using Flash 8.

Thanks!!
