Question about an ESRI's sample code for Cached Map

Discussion created by shaningesri on Jul 16, 2011
Latest reply on Jul 18, 2011 by DSwingley-esristaff
This is regarding one of ESRI's sample code in ArcGIS Extension for Google Map API.  For How to Add ArcGIS Server Cached Map (at, the topic is /Map/Add ArcGIS Server cached map), ESRI provides a smaple code at
On Lines 30 and 32 of this script, a variable  gTileLayer  is used.

      //create custom tile layer - Line 26
      var tiledmap = new esri.arcgis.gmaps.TiledMapServiceLayer("", mapOptions, addTiledMap);

    function addTiledMap(gTileLayer) {   // Line 30 
    //Add tile layer as a GTileLayerOverlay using mapExtension
      gOverlays = mapExtension.addToMap(gTileLayer);  // Line 32    }

However, this variable is not defined before.  I wonder how a tiled layer can be added on the map.  I wish ESRI can provide an answer for it.  Thanks.