# Scrolling based on Mouse x location

**URL:** <https://forum.kirupa.com/t/scrolling-based-on-mouse-x-location/39239>\
**Category:** flash\
**Created:** [January 5, 2004, 7:19am UTC](https://forum.kirupa.com/t/scrolling-based-on-mouse-x-location/39239 "2004-01-05T07:19:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![macneilslt](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@macneilslt](https://forum.kirupa.com/u/macneilslt)\
**Post date:** [January 5, 2004, 7:19am UTC](https://forum.kirupa.com/t/scrolling-based-on-mouse-x-location/39239/1 "2004-01-05T07:19:30Z")

</div>

lets say I have a movie with dimensions of width 300, height 400  
and i have a MC with a width of 600, centered on the movie…  
I’m trying to scroll it to the left and right, with boundries using this AS on the MC.

[AS]  
onClipEvent(enterFrame) {  
// move right  
if((\_root.\_xmouse \>= 200)and this.\_x \>= 0) {  
this.\_x +=5;  
}  
// move left  
else if((\_root.\_xmouse \<= 100)and this.\_x \<= -300) {  
this.\_x -=5;  
}  
}

[/AS]

but it doesn’t quite work right, the boundries are wrong, can anyone correct that for me?
