# Idle Scroll Speed

**URL:** <https://forum.kirupa.com/t/idle-scroll-speed/116068>\
**Category:** Uncategorized\
**Created:** [July 14, 2004, 12:06pm UTC](https://forum.kirupa.com/t/idle-scroll-speed/116068 "2004-07-14T12:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SmileyGladhand](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@SmileyGladhand](https://forum.kirupa.com/u/SmileyGladhand)\
**Post date:** [July 14, 2004, 12:06pm UTC](https://forum.kirupa.com/t/idle-scroll-speed/116068/1 "2004-07-14T12:06:45Z")

</div>

Hi,

I’m using the following code to continuously scroll an image. I want to keep the mouseover but I need a way to make it scroll at an idle speed when the mouse isn’t over the image. I’d greatly appreciate any help.

onClipEvent (load)  
{  
mouseOn = false;  
xcenter=600;  
speed=1/10;  
}

on(rollOver)  
{  
mouseOn = true;  
}

on(rollOut)  
{  
mouseOn = false;  
}

onClipEvent (enterFrame)  
{  
if(mouseOn)  
{  
var distance=\_root.\_xmouse-xcenter;  
\_x+=(distance\*speed);  
if (\_x \> 0) \_x=-1950;  
if (\_x \< -1950) \_x=0;  
}  
}

Thanks
