Zoom to Graphic?

Discussion created by jadams52451 on Aug 3, 2011
Latest reply on Aug 5, 2011 by jadams52451
Is it possible to zoom to a graphic? 

My Application allows a user to enter a Parcel Number and use the findTask to create a graphic over the correct Parcel on the map.  But there are a lot of parcels so I would like to be able to zoom to the graphic.  Is this possible?

I've looked at centerAndZoom(point, lvl).  But I cant seem to figure out how to get a point from my graphic because its as Polygon not a Point.

Thanks for the help in Advance.

      //Executed to search for a Parcel with the correct Map and Page number
      function findParcel() { 
        //set the search text to find parameters 
        var searchText = dojo.byId("Map").value;
        if (searchText.length == 4) {
          searchText = searchText + "  " + dojo.byId("Page").value;
        else if (searchText.length == 3 ){          
          searchText = searchText + "   " + dojo.byId("Page").value;         
        findParams.searchText = searchText; 
        findTask.execute(findParams, showParcel); 
     function showParcel(results) { 
        //symbology for graphics 
        var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 0, 0, 0.5])); 
        //find results return an array of findResult. 
        //Build an array of attribute information and add each found graphic to the map 
        dojo.forEach(results, function(result) { 
          var graphic = new esri.Graphic(result.feature);