Hi,
I have created a horizontal slider Bar…and the fundamentals of it work properly… as you slide it, it displays a value between 1-100 in a text field… my problem is that if I stop dragging on an even number, i.e. 59, when I move my mouse after that it bumps the number up to the next even number… i.e 59 goes to 60.
I am using ‘onMouseMove’ to track the position of the slider bar and update the value, so I am wondering if that is causing it… since if I just stop dragging and don’t move my mouse afterwards, it will stay on the even #…but as soon as I move it, it rounds it up to an even number.
Any ideas?
My code is below, as well as my .fla attached.
Thanks!
-b.
stop();
//init slider Position/value
this.knob_mc._x=_root.currentClip._xscale;
_root.scaleControl_mc.scale_txt.text=this.knob_mc._x;
this.knob_mc.onPress = function(){
this.startDrag(false, _root.scaleControl_mc.slider_mc.groove_mc._x, _root.scaleControl_mc.slider_mc.knob_mc._y, _root.scaleControl_mc.slider_mc.groove_mc._x + 100, _root.scaleControl_mc.slider_mc.knob_mc._y);
};
this.knob_mc.onRelease = function(){
stopDrag();
trace(_root.val);
play();
};
this.knob_mc.onReleaseOutside = function(){
this.stopDrag();
play();
}
this.knob_mc.onMouseMove = function(){
var myPoint:Object = new Object();
myPoint.x = this._x;
myPoint.y = this._y;
_root.globalToLocal(myPoint);
//_root.val=Math.floor(myPoint.x);
_root.val=myPoint.x;
trace("value = " + _root.val);
_root.outterMC._xscale=_root.val;
_root.outterMC._yscale=_root.val;
//_root.currentClip._xscale=_root.val;
//_root.currentClip._yscale=_root.val;
_root.scaleControl_mc.scale_txt.text="" + _root.val;
}