Navigating around points on a map

Hello! I have a large map image that I want to navigate around. There are certain points on the map that I want to go to when links are pressed. What i’m doing is just moving the map around so that you can only see certain bits of it.

I have worked out the code to make it go to certain points, but the animation is not smooth. It currently just moves to the coordinates and then stops. I want to ease it into position.

Can anyone help? I have pasted my working code below.

Thanks!! :slight_smile:

 
moveMap = function(xCoord,yCoord){
  
  //--work out the distance
  dX=xCoord-Math.abs(map._x);
  dY=yCoord-Math.abs(map._y);
  
  if(xCoord>(550/2))
   dX-=(550/2);
   
  if(yCoord>(400/2))
   dY-=(400/2);     
  
  //--how many frames it will take
  steps=60;
  
  //--work out the speed
  sX=dX/steps;
  sY=dY/steps;
  
  stepCount=0;
 
 map.onEnterFrame = function(){
      
  if(stepCount<steps)
  {
   this._x-=sX;
   this._y-=sY;
  }
  else
  {
   delete(this.onEnterFrame);
  }
  
  stepCount++;  
 }
}