# Problem with a function

**URL:** <https://forum.kirupa.com/t/problem-with-a-function/172041>\
**Category:** Uncategorized\
**Created:** [December 10, 2005, 7:14am UTC](https://forum.kirupa.com/t/problem-with-a-function/172041 "2005-12-10T07:14:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ozymandias](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ozymandias/32/1997_2.png) [@Ozymandias](https://forum.kirupa.com/u/Ozymandias)\
**Post date:** [December 10, 2005, 7:14am UTC](https://forum.kirupa.com/t/problem-with-a-function/172041/1 "2005-12-10T07:14:44Z")

</div>

For some reason this keeps moving my thumbnail\_mc even when thumbnail\_mc is well away from brake\_right and hit\_right. When I move the mouse back and forth onto and off one of the thumbnails it sorta hops to the left ten pixels every time I hover over it again. Please help me figure this out! If you need the .fla just let me know and I’ll upload it somewhere.

function thumbNailScroller(total) {  
// thumbnail code!  
this.createEmptyMovieClip(“tscroller”, 1000);  
scroll\_speed = 10;  
brakeSpeed = 10;  
tscroller.onEnterFrame = function() {  
if (hit\_right.hitTest(this.\_xmouse, this.\_ymouse) && thumbnail\_mc.hitTest(brake\_right)) {  
thumbnail\_mc.\_x -= scroll\_speed;  
} else {  
thumbnail\_mc.\_x -= brakeSpeed;  
brakeSpeed = brakeSpeed-1;  
if (brakeSpeed=0) {  
delete tscroller.onEnterFrame;  
}  
}  
if (hit\_left.hitTest(this.\_xmouse, this.\_ymouse) && thumbnail\_mc.hitTest(brake\_left)) {  
thumbnail\_mc.\_x += scroll\_speed;  
} else {  
thumbnail\_mc.\_x += brakeSpeed;  
brakeSpeed = brakeSpeed-2;  
if (brakeSpeed=0) {  
delete tscroller.onEnterFrame;  
}  
}  
};  
}
