# Idle Scroll Speed

**URL:** <https://forum.kirupa.com/t/idle-scroll-speed/57569>\
**Category:** flash\
**Created:** [July 14, 2004, 12:06pm UTC](https://forum.kirupa.com/t/idle-scroll-speed/57569 "2004-07-14T12:06:45Z")\
**Posts on this page:** 2\
**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/57569/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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 14, 2004, 12:08pm UTC](https://forum.kirupa.com/t/idle-scroll-speed/57569/2 "2004-07-14T12:08:12Z")

</div>

I also noticed the image jumps when I first put the mouseover. Any ideas on that?
