# Scrolling MC

**URL:** <https://forum.kirupa.com/t/scrolling-mc/309295>\
**Category:** Uncategorized\
**Created:** [May 11, 2010, 5:38pm UTC](https://forum.kirupa.com/t/scrolling-mc/309295 "2010-05-11T17:38:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![colouredFunk](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@colouredFunk](https://forum.kirupa.com/u/colouredFunk)\
**Post date:** [May 11, 2010, 5:38pm UTC](https://forum.kirupa.com/t/scrolling-mc/309295/1 "2010-05-11T17:38:31Z")

</div>

Hi all,

I’m using the following code to move my MC left and right with the mouse. But I need to flip the direction that the code works, I’ve tried and tried but can’t seem to get it working. Please can someone help me out!

```auto
var r:Number = (mouseX)/(stage.stageWidth);
   var left:Number = 0
   var dx:Number = Math.round((((left - (left - scrollMaxX) * r) - (_tCamera.x)) / speed) * friction);
   _tCamera.x += dx

```

Thanks
