This should be an easy to solve but my brain has been fried the last few days. I have a slider that zooms in and zooms out a image. I want to zoom into the pixel level and zoom out to the pixel level but I have to have the thumbnail button be centered in the slider for a scale of 1.
What I have now is,
In code:
// if the scale value is 1 the image is shown at original size
var scale:Number = zoomSlider.value/1000;
sprite.scaleX = sprite.scaleY = scale;
I set the default value to 5000 so that the button is centered in the middle but that sets the scale to 5. What I want is when I drag left (from the initial value of 5000) it should start to scale down until it gets to the minimum scale of .10. When I drag right it should start to increase the scale to 10.
The key to this question is that I have to have the thumbnail button centered in the middle of the slider and when centered the scale is 1.
If you want the scale for 0 to 10,000 (since you specified center to be 5000) as above, then use
Whatever be the Scale, To keep the Scale Button centered and Image scaled to 1, set the ‘scale’ variable to 1/2 of the max Scale value.