KeithPalmer
Emerging Contributor
You're in luck Bo.  I needed to do this today too so I pulled together the logic from various samples (yes, I hate reinventing the "wheel"):

private function zoomSelected():void
{
if (graphicsLayer.numGraphics > 0)
{
  var pt:MapPoint = new MapPoint();
  var extSelected:Extent;
  for each (var selgra:Graphic in graphicsLayer.graphicProvider)         
     {
        pt = getGeomCenter(selgra);
  //Calculate the Selected Feature Extent
          if (extSelected == null) {
                 extSelected= new Extent(pt.x,pt.y,pt.x,pt.y);
            } else {
               if (pt.x > extSelected.xmax) {extSelected.xmax=pt.x;}
               if (pt.y > extSelected.ymax) {extSelected.ymax=pt.y;}
               if (pt.x < extSelected.xmin) {extSelected.xmin=pt.x;}
               if (pt.y < extSelected.ymin) {extSelected.ymin=pt.y;}
       }           
     }      
    }
    map.extent= extSelected.expand(2);   
}

-Keith
0 Kudos