I have a button on the stage that centers. I have a zoom slider on the stage too. That code is in red.
The button moves to x=400, y=200. Once it moves to that point I would like zoom slider to zoom keeping that coordinate in the center of its zooming range. Do I need to add something to zoom code?
Here is a view…Click on 39, bluish polygon on map. Then move zoom slider in and out. The 39 is not centered as it zooms.
http://www.sergemedia.net/ds2/map/lakemap.html
Ideally I would like zoom slider to zoom in and out of current centered position regardless of maps position. So that may be the better question.
Could this call for onEnterFrame?
stopAllMCs = function(){
//map_mc.site39_mc.stop();
//map_mc.site40_mc.stop();
// The above works...
// but for the clips to return to their original state...
// and not only stop at whatever frame they're at...
// you might better use...
map_mc.site39_mc.gotoAndStop(1);
map_mc.site40_mc.gotoAndStop(1);
};
_root.map_mc.site39_mc.onRelease = function(){
[COLOR="Red"]//begin slider code
_root.slide_mc.onLoad=function(){
scrollMin = _root.range._x+_root.range._width // minimum _x value possiible for scrollbar
scrollMax = _root.range._x // maximum _x value possiible for scrollbar
lowestScale = 50 // lowest desired scale of map in %
highestScale = 200 // highest desired scale of map in %
_x = scrollMin + (scrollMax - scrollMin)/2 //starting point
scaleFactor = Math.pow(highestScale/lowestScale,1/(scrollMax-scrollMin)) // variable for SetScale
function SetScale(){
// calculates scale and sets it
_root.scale = _root.map_mc._xscale = _root.map_mc._yscale = lowestScale * Math.pow(scaleFactor,(scrollMax-_x))
}
SetScale()
}
_root.slide_mc.onMouseMove=function(){
if (dragging){
_x = Math.min(Math.max(_parent._xmouse,scrollMax),scrollMin)
SetScale()
updateAfterEvent();
}
}
//end slider code[/COLOR]
stopAllMCs();
map_mc.site39_mc.play();
_root.srchMC._visible=false;
_root.info_mc._visible=true;
_root.info_mc.gotoAndStop(1);
if (this.pressed) {
_root.map_mc._x = 400 - _root.map_mc.site39_mc._x;
_root.map_mc._y = 200 - _root.map_mc.site39_mc._y;
} else {
_root.map_mc._x = 400 - _root.map_mc.site39_mc._x;
_root.map_mc._y = 200 - _root.map_mc.site39_mc._y;
}
_root.map_mc._xscale=100;
_root.map_mc._yscale=100;
this.pressed = !this.pressed;
};