# \[F5\] Looping in Actionscript (or another solution)

**URL:** <https://forum.kirupa.com/t/f5-looping-in-actionscript-or-another-solution/236814>\
**Category:** flash\
**Created:** [August 23, 2007, 7:28pm UTC](https://forum.kirupa.com/t/f5-looping-in-actionscript-or-another-solution/236814 "2007-08-23T19:28:07Z")\
**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:** [August 23, 2007, 7:28pm UTC](https://forum.kirupa.com/t/f5-looping-in-actionscript-or-another-solution/236814/1 "2007-08-23T19:28:07Z")

</div>

Hey, anyway, my problem is this, I am creating a photo gallery, but I want it to scroll when the user puts their cursor over a button. The code I’ve used so far is this

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

which works fine, however I can’t figure out a way to constantly execute this script for as long as the user keeps their cursor on the button (which this code is in). The only thing I can think of is using an if statement, but Im still fairly new to actionscript, and Ive tried a few diffrent ways and haven’t had much luck. Any help would be appreciated! Thanks!
