Advanced Flash Components
Search!
Search!
Home >  Knowledge Base >  G Map >  panTo finish animating?
panTo finish animating?
Date: Apr 18, 2007   Views: 2777  
Question:
How do I know when GMap.panTo(lat:Number, lng:Number) is not animating? When I use GMap.addEventListener("moveEnd", eventListener);, I know the smooth animation is finished. But what if this animation is not taking place, because the center point is not visible in the current map view?
Answer:
Unfortunately, this is not implemeted. Although you can calculate wether the panning animation we be made. Here is an example:



var pan_lng:Number = 8;

var pan_lat:Number = 58;
trace(gmap.longitude + ", " + gmap.latitude);
var center:Object = gmap.getBitmapCoordinate(gmap.longitude, gmap.latitude);
var target:Object = gmap.getBitmapCoordinate(pan_lng, pan_lat);

var b:Object = new gmap.rect(center.x - gmap.width / 2, center.y - gmap.height / 2, center.x + gmap.width / 2, center.y + gmap.height / 2)

if(target.x > b.left && target.x < b.right && target.y > b.top && target.y < b.bottom) {

trace("panning will be made");

// call panTo here
gmap.panTo(pan_lng, pan_lat);

} else {

trace("no panning, just setCenter");

// call setCenter here
gmap.setCenter(pan_lng, pan_lat);
}
Component Info