# Image scroller keeps going & going & going

**URL:** <https://forum.kirupa.com/t/image-scroller-keeps-going-going-going/286673>\
**Category:** Uncategorized\
**Created:** [April 18, 2009, 10:22pm UTC](https://forum.kirupa.com/t/image-scroller-keeps-going-going-going/286673 "2009-04-18T22:22:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![julien2007](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@julien2007](https://forum.kirupa.com/u/julien2007)\
**Post date:** [April 18, 2009, 10:22pm UTC](https://forum.kirupa.com/t/image-scroller-keeps-going-going-going/286673/1 "2009-04-18T22:22:33Z")

</div>

Hi,

My original goal was to drag&click/scroll horizontally a very wide image. I found and tried to transform a free panoramic scroller but I can’t figure out how to restrict the image to its own width, instead it keeps going on on either side when the picture ends. I like the motion and I don’t want to change the scrolling type. It’s fine as is except for that little thing. Any simple tip?

–stage size is 1020 x 550  
–image size is 3700x550  
–The AS2 code is:

function initImageScroll() {  
introState = “fadein”;  
}  
function ImageScroll() {  
if (introState == “fadein”) {  
b = ImageStroke1.\_alpha+14;  
if (b\>=100) {  
b =100;  
}  
ImageStroke1.\_alpha = b;  
}  
if (state == “scroll”) {  
stepX = (startX-\_xmouse)/5;  
ImageStroke1.\_x = ImageStroke1.\_x + stepX;  
}  
}  
initImageScroll();  
this.onEnterFrame = function() {  
ImageScroll();  
};  
Mouse.hide();  
cursor\_mc.startDrag(“true”);

–oh and the associated ImageStroke1 (the image mc) code is: -

this.onPress = function() {  
var \_l2 = \_root;  
\_l2.state = “scroll”;  
\_l2.startX = \_l2.\_xmouse;  
};  
this.onRelease = this.onReleaseOutside=function () {  
\_root.state = “off”;  
};
