# Sticky slider issue

**URL:** <https://forum.kirupa.com/t/sticky-slider-issue/49099>\
**Category:** Uncategorized\
**Created:** [April 19, 2004, 11:03pm UTC](https://forum.kirupa.com/t/sticky-slider-issue/49099 "2004-04-19T23:03:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pspecial](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@pspecial](https://forum.kirupa.com/u/pspecial)\
**Post date:** [April 19, 2004, 11:03pm UTC](https://forum.kirupa.com/t/sticky-slider-issue/49099/1 "2004-04-19T23:03:27Z")

</div>

Can someone maybe pick out the reason my code is breaking…

I am trying to create a slider bar that also has arrows. Basically the same thing youd see on the right border of most browsers or document editors.

Everything works fine except for the following: as soon as I use the “dragger”, the up/down arrows break.

I’ve poured over this code for several hours and just cant see why. I have a distinct feeling its something to do with the nested onEnterFrame in dragger.onPress… this.startDrag().

Anyway, here’s the code:

/// --------------------------------------------------------

var ratio = 0  
var spd = 7;  
var scroll = 0;

/// UP/DOWN ARROWS -------------------------------

up\_btn.onPress = function() {  
scroll = 1;  
}  
up\_btn.onRelease = function() {  
scroll = 0;  
}  
dwn\_btn.onPress = function() {  
scroll = 2;  
}  
dwn\_btn.onRelease = function() {  
scroll = 0;  
}

/// FRAME ACTIONS ---------------------------------------------

onEnterFrame = function() {

```
if(scroll == 1 && ratio &gt;= -8) {
	ratio -= 1;
} else if (scroll == 2 && ratio &lt;= 247) {
	ratio += 1;
} 

// calculates ratios for 'resume' and 'dragger'
qq = Math.round(ratio + 41 - (ratio * 2.5));
rr = ratio + 201;

// displays X & Y coordinates
this.xCoor = Math.floor(_root._xmouse) + ".00";
this.yCoor = Math.floor(_root._ymouse) + ".00";

```

}

/// DRAGGER ACTIONS ----------------------------------------------------

dragger.onEnterFrame = function() {  
if(ratio \>= 0 && ratio \<= 245) {  
this.\_y = rr;   
}  
}

dragger.onPress = function() {  
this.startDrag(“true”, 690, 201, 690, 442);  
this.onEnterFrame = function() {  
ratio = Math.round(this.\_y - 201);  
}  
}

dragger.onRelease = function() {  
this.stopDrag();  
}
