# Image scroller problems

**URL:** https://forum.kirupa.com/t/image-scroller-problems/311022
**Category:** Uncategorized
**Created:** [June 25, 2010, 7:46am UTC](https://forum.kirupa.com/t/image-scroller-problems/311022 "2010-06-25T07:46:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ludob](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@ludob](https://forum.kirupa.com/u/ludob)
#### Post date: [June 25, 2010, 7:46am UTC](https://forum.kirupa.com/t/image-scroller-problems/311022/1 "2010-06-25T07:46:08Z")

</div>

Hi,

a friend of mine had a website done a some time back. im currently studying and im trying to help him.  
He has a scrolling image gallery and the code is like this:

onClipEvent(load) {

```
//this._alpha = 0;

```

//nScreenWidth = 1000;  
nMaxRate = 5;  
// nPixels determines the speed of the slider movement  
function moveLeft(nPixels) {  
this.\_x -= nPixels;  
if (this.\_x \< -3566) {  
this.\_x = 5027;  
}  
}  
function moveRight(nPixels) {  
this.\_x += nPixels;  
if (this.\_x \> 5027) {  
this.\_x = -3566;  
}  
}  
}

onClipEvent(enterFrame) {

```
//if (this._alpha &lt; 100) {
	//this._alpha += 3;
//}

```

// move slider with speed dependent on mouse position  
if (\_root.\_xmouse \< Stage.width/2 && \_root.\_xmouse \> 0) {  
moveRight(nMaxRate - \_root.\_xmouse \* nMaxRate/(Stage.width/2));  
} else {  
if (\_root.\_xmouse \> Stage.width/2 && \_root.\_xmouse \< Stage.width) {  
moveLeft(\_root.\_xmouse \* nMaxRate/(Stage.width/2) - nMaxRate);  
}  
}  
}

the movie clip that holds all the photo’s width and height is 17126 pixels by 200 pixels high

the movie clips x position and y position is 3566x and 0y

now this code works perfectly fine but as soon as i add a picture to the movie clip so it can scroll it it jumps every time it loops…

i know that this value in the code ="-3566" is the x position of the movie clip  
but how did they get this value =“5027” in the code?

i think if i figure this out the gallery will work fine even after adding images no?

Please any help is good thank you.
