# Conflict between buttons because of inertia code

**URL:** https://forum.kirupa.com/t/conflict-between-buttons-because-of-inertia-code/200047
**Category:** flash
**Created:** [September 8, 2006, 8:15am UTC](https://forum.kirupa.com/t/conflict-between-buttons-because-of-inertia-code/200047 "2006-09-08T08:15:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nova4](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@Nova4](https://forum.kirupa.com/u/Nova4)
#### Post date: [September 8, 2006, 8:15am UTC](https://forum.kirupa.com/t/conflict-between-buttons-because-of-inertia-code/200047/1 "2006-09-08T08:15:18Z")

</div>

Hey it’s me again!!!  
Ok here’s my problem :  
I have 4 buttons that scroll an image when rolled-over. I’ve added inertia to them, just to mak’em look better, and it works fine…  
In an other part of the navigation (that is to say in a different movie clip) I have a button that resets the image scrolled with the above function in the middle of the page…and it looks like the inertia is also applied to this button against my will, instead of just being re-centered, the image shifts…  
it used to work smoothly untill I added inertia to the scrolling, i guess there’s some kind of a conflict somewhere…

Here’s the reset code that re-centers the image in the scene :

center.onRelease = function () {  
\_parent.pages.\_x = 400;  
\_parent.pages.\_y = 300;  
}

And here’s the code for the scrolling (!!THIS ISN’T IN THE SAME MOVIE CLIP!!) :

dest = 350;

up.onRollOver = function():Void {  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_y -= 4;  
}  
}  
up.onRollOut = function():Void {  
\_parent.pages.dest = \_parent.pages.\_y - 13;  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_y += (\_parent.pages.dest - \_parent.pages.\_y) /7;  
if(\_parent.pages.\_y - \_parent.pages.dest \< 0.5) {  
\_parent.pages.\_y = \_parent.pages.dest;  
delete \_parent.pages.dest;  
delete \_parent.pages.onEnterFrame;  
}  
}  
}  
down.onRollOver = function():Void {  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_y += 4;  
}  
}  
down.onRollOut = function():Void {  
\_parent.pages.dest = \_parent.pages.\_y + 13;  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_y += (\_parent.pages.dest - \_parent.pages.\_y) /7;  
if(\_parent.pages.\_y + \_parent.pages.dest \< 0.5) {  
\_parent.pages.\_y = \_parent.pages.dest;  
delete \_parent.pages.dest;  
delete \_parent.pages.onEnterFrame;  
}  
}  
}  
left.onRollOver = function():Void {  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_x -= 4;  
}  
}  
left.onRollOut = function():Void {  
\_parent.pages.dest = \_parent.pages.\_x - 13;  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_x += (\_parent.pages.dest - \_parent.pages.\_x) /7;  
if(\_parent.pages.\_x + \_parent.pages.dest \< 0.5) {  
\_parent.pages.\_x = \_parent.pages.dest;  
delete \_parent.pages.dest;  
delete \_parent.pages.onEnterFrame;  
}  
}  
}  
right.onRollOver = function():Void {  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_x += 4;  
}  
}  
right.onRollOut = function():Void {  
\_parent.pages.dest = \_parent.pages.\_x + 13;  
\_parent.pages.onEnterFrame = function():Void {  
\_parent.pages.\_x += (\_parent.pages.dest - \_parent.pages.\_x) /7;  
if(\_parent.pages.\_x + \_parent.pages.dest \< 0.5) {  
\_parent.pages.\_x = \_parent.pages.dest;  
delete \_parent.pages.dest;  
delete \_parent.pages.onEnterFrame;  
}  
}  
}

Weird thing is, the “up” button functions normally, the three other buttons (down, left, right) are driving me insane!!  
I’ve tries a bunch of modifications but I just can’t figure this out. My guess is the problem has something to do with the onEnterFrames used in the scrolling codes…  
Does anyone have a solution to this problem?:huh:
