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 >= -8) {
ratio -= 1;
} else if (scroll == 2 && ratio <= 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();
}