AnsweredAssumed Answered

scaleUtils with AMD - Accessing from separate .js file

Question asked by ghilton on Apr 15, 2015

I am somewhat new to the javascript api and especially AMD.  I have a VS 2012 solution with multiple js files.  In a file named load.js I have the following code:

 

require([

  "esri/map",

  "esri/geometry/scaleUtils",

  "dojo/domReady!"

],

 

function (

  Map, scaleUtils

) {

  

// Full extent of map

fullExtent = new esri.geometry.Extent({ "xmin": fullMinX, "ymin": fullMinY, "xmax": fullMaxX, "ymax": fullMaxY, "spatialReference": { "wkid": fullWKID } });

 

   map = new Map("map", {

        basemap: "topo",

        showAttribution: false,

        slider: false,

        logo: false,

        center: [-73.678, 43.362],

        zoom: 11

 

   });

 

In a separate .js file I would like to access scaleUtils in order to return map scale (scaleUtils.getScale(map)) when the map extent changes.  I'm not sure how to acceess scaleUtils from the separate .js file.  I've tried to create a variable in my separate .js file like this: var scale = scaleUtils.getScale(map);  This does not seem to work.  Any information on how I can access scaleUtils from a separate .js file would be appreciated. 

Outcomes