# \[F8\] Using setInterval to repeat an action

**URL:** <https://forum.kirupa.com/t/f8-using-setinterval-to-repeat-an-action/238168>\
**Category:** flash\
**Created:** [September 7, 2007, 8:19pm UTC](https://forum.kirupa.com/t/f8-using-setinterval-to-repeat-an-action/238168 "2007-09-07T20:19:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mugi](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mugi](https://forum.kirupa.com/u/mugi)\
**Post date:** [September 7, 2007, 8:19pm UTC](https://forum.kirupa.com/t/f8-using-setinterval-to-repeat-an-action/238168/1 "2007-09-07T20:19:20Z")

</div>

Here is my issue. I am trying to create a scrolling menu with clickable objects on it. I can get the menu to move with on(release) and on(rolOver) [on(rollOver) is the function I want to use, as I want the menu to scroll as long as the use hovers their cursor over a button]. It works by having the menu and buttons tweened from frame 1 to 40, so if the button is pressed or rolled over it adds one to the scroll variable, and then goes to the next frame like this:

on(rollOver){  
var scroller = scroller +1;  
gotoAndStop(scroller);  
}

What I want to accomplish a few things

- keep scrolling while the use keeps their mouse over the button
- stop when they remove it
- repeat at a specific rate

Ive been doing research and trying diffrent things, I think setInterval is what I want to use, but I have no clue at all how to implement it. Ive been working at this for weeks now and its getting a bit frustrating so some more help would be really appreciated. Ive seen a few tutorials online that accomplish similar but I have a bit of a hard time understanding and following all of the examples as most assume you have a greater knowledge of AS2.0 so I am a bit lost atm.
