# Scripted animation with setInterval

**URL:** https://forum.kirupa.com/t/scripted-animation-with-setinterval/157946
**Category:** flash
**Created:** [August 5, 2005, 10:11am UTC](https://forum.kirupa.com/t/scripted-animation-with-setinterval/157946 "2005-08-05T10:11:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![PaintedSwan](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@PaintedSwan](https://forum.kirupa.com/u/PaintedSwan)
#### Post date: [August 5, 2005, 10:11am UTC](https://forum.kirupa.com/t/scripted-animation-with-setinterval/157946/1 "2005-08-05T10:11:26Z")

</div>

Hello all 😃

What I have is actionscript which moves a movieclip from one point of the stage to another, using two buttons to trigger it - fwd\_btn and rwd\_btn. I also use a setInterval function, so that when you press one of the buttons, it pauses a second before moving. Unfortunately, if you press the fwd and rwd buttons in succession rapidly, the animation gets caught in a never-ending loop. If someone could take a look at my example and let me know how to stop this, I’d be very grateful. Thanks. 🙂

\*\*Edit  
Also, note that every time the user clicks a button, if the movieclip is right in the middle of animating across the stage, I wish it to stop and pause, not complete the animation and then pause.

-swan
