Hi All
I have created a flash which zooms a map with CTRL+click and zoom out with SHIFT+ click. When user double clicks on the map the map zooms and pan the map center to the point where user double clicked.
import mx.transitions.Tween;
import mx.transitions.easing.;
//===============================
startHeight = 450;
startWidth = 600;
initMapx = map._x;
initMapy = map._y;
function zoom(amount) {
trace(" Amount : "+amount);
xoffset = startWidth(map._x-startX)/(100/amountmap._width)-dragX;
yoffset = startHeight(map._y-startY)/(100/amount*map._height)-dragY;
trace(" xoffset : “+xoffset);
trace(” yoffset : "+yoffset);
map._xscale = map._xscale+amount;
map._yscale = map._yscale+amount;
endEaseX = initMapx+xoffset;
endEaseY = initMapy+yoffset;
x_coord = map._x;
y_coord = map._y;
trace(x_coord);
//auto paning
if (_global.drawValue == 1) {
trace(“Inside If”);
var xPosT:Tween = new Tween(map, “_x”, Regular.easeIn, map._x, endEaseX, 1, true);
var yPosT:Tween = new Tween(map, “_y”, Regular.easeIn, map._y, endEaseY, 1, true);
} else {
trace(“Inside Else”);
var xPosT:Tween = new Tween(map, “_x”, Regular.easeIn, map._x, endEaseX, 1, true);
var yPosT:Tween = new Tween(map, “_y”, Regular.easeIn, map._y, endEaseY, 1, true);
}
I have a button “DRAW”. When a user click on this button, then he/she be able to click and drag the mouse to select an area of the map to ZOOM.
My problem is that I want this area to be centered Like i have for double click.
PLZ help.
Thanks