# Conflicting Codes

**URL:** <https://forum.kirupa.com/t/conflicting-codes/210043>\
**Category:** flash\
**Created:** [December 14, 2006, 11:41am UTC](https://forum.kirupa.com/t/conflicting-codes/210043 "2006-12-14T11:41:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![g\_rochford](https://avatars.discourse-cdn.com/v4/letter/g/c57346/32.png) [@g\_rochford](https://forum.kirupa.com/u/g_rochford)\
**Post date:** [December 14, 2006, 11:41am UTC](https://forum.kirupa.com/t/conflicting-codes/210043/1 "2006-12-14T11:41:37Z")

</div>

Hi All

I have two codes on my main page. One makes my juke box dragable and one controls my dragable slider. The problem is if i implement the juke box code it sends the slider code mental, I guess this is to do with the fact that both codes are using the startDrag function. Is there a way around this without losing the functionality of it?

**This one to enable my juke box to be dragable…**

var left:Number;  
var top:Number;  
var right:Number;  
var base:Number;  
onEnterFrame=function(){  
left=player\_mc.\_x;  
top=player\_mc.\_y;  
right=player\_mc.\_x+215;  
base=player\_mc.\_y+60;  
if ((\_xmouse\>left)&&(\_xmouse\<right)&&(\_ymouse\>top)&&(\_ymouse\<base)){  
player\_mc.\_alpha=100;  
}else{  
player\_mc.\_alpha=70;  
}  
};  
player\_mc.move\_btn.onPress=function(){  
startDrag(\_root.player\_mc);  
};  
player\_mc.move\_btn.onRelease=function(){  
stopDrag();  
};

**And this one is for my text pages to have a dragable slider**

fscommand(“allowscale”, “false”);  
bar.useHandCursor = dragger.useHandCursor=false;  
space = 20;  
friction = 0.9;  
speed = 4;  
y = dragger.\_y;  
top = main.\_y;  
bottom = main.\_y+mask\_mc.\_height-main.\_height-space;  
dragger.onPress = function() {  
drag = true;  
this.startDrag(false, this.\_x, this.\_parent.y, this.\_x, this.\_parent.y+this.\_parent.bar.\_height-this.\_height);  
dragger.scrollEase();  
};  
dragger.onMouseUp = function() {  
this.stopDrag();  
drag = false;  
};  
bar.onPress = function() {  
drag = true;  
if (this.\_parent.\_ymouse\>this.\_y+this.\_height-this.\_parent.dragger.\_height) {  
this.\_parent.dragger.\_y = this.\_parent.\_ymouse;  
this.\_parent.dragger.\_y = this.\_y+this.\_height-this.\_parent.dragger.\_height;  
} else {  
this.\_parent.dragger.\_y = this.\_parent.\_ymouse;  
}  
dragger.scrollEase();  
};  
bar.onMouseUp = function() {  
drag = false;  
};  
moveDragger = function (d) {  
if ((dragger.\_y\>=y+bar.\_height-dragger.\_height && d == 1) || (dragger.\_y\<=y && d == -1)) {  
clearInterval(myInterval);  
} else {  
dragger.\_y += d;  
dragger.scrollEase();  
updateAfterEvent();  
}  
};  
up\_btn.onPress = function() {  
myInterval = setInterval(moveDragger, 18, -1);  
};  
down\_btn.onPress = function() {  
myInterval = setInterval(moveDragger, 18, 1);  
};  
up\_btn.onMouseUp = down\_btn.onMouseUp=function () {  
clearInterval(myInterval);  
};  
MovieClip.prototype.scrollEase = function() {  
this.onEnterFrame = function() {  
if (Math.abs(dy) == 0 && drag == false) {  
delete this.onEnterFrame;  
}  
r = (this.\_y-y)/(bar.\_height-this.\_height);  
dy = Math.round((((top-(top-bottom)\*r)-main.\_y)/speed)\*friction);  
main.\_y += dy;  
};  
};
