My public-facing application is throwing errors in the live environment which I can't reproduce in dev or test. The errors are:
Error in method ShowLoadingImage of common_v1.1.js on line 1: Object [object Object] has no method 'enableMouseWheel'
and
Error in method ShowLoadingImage of common_v1.1.js on line 1: 'undefined' is not a function.
The code for the ShowLoadingImage function is as follows:
function ShowLoadingImage()
{
try
{
// Get the parameters and set up the image.
var mapWidth = 0;
var mapHeight = 0;
var mapIsNull = false;
if (_map != null && _map != 'undefined')
{
mapWidth = _map.width;
mapHeight = _map.height;
}
else
{
mapIsNull = true;
}
var loadingImage = dojo.byId("uxLoadingImg");
var uxNavigationDiv = dojo.byId("uxNavigationDiv");
if (loadingImage != null && loadingImage != 'undefined')
{
if (mapWidth != null && mapWidth != 'undefined' && mapHeight != null && mapHeight != 'undefined')
{
// Calculate the location of the middle of the map.
if (mapWidth > 0)
{
loadingImage.style.left = mapWidth / 2 + "px";
}
if (mapHeight > 0)
{
loadingImage.style.top = mapHeight / 2 + "px";
}
}
// Show the loading image.
esri.show(loadingImage);
}
if (!mapIsNull)
{
// Hide the other tools.
_map.disableMapNavigation();
_map.disablePan();
_map.hideZoomSlider();
}
// Hide the navigation tool, if it is present.
if (uxNavigationDiv != null && uxNavigationDiv != 'undefined')
{
esri.hide(uxNavigationDiv);
}
}
catch (ex)
{
onerror(ex.message, "method ShowLoadingImage of common_v1.1.js", "1");
}
}
I don't have a function 'enableMouseWheel in my code, but if I run the application in debug mode I notice that the _map object (an esri map object) has this function, although it isn't mentioned in the documentation for the version of the javascript api that I am using (2.7), so it looks as if, in some circumstances, this function is undefined and so an error is thrown.
Does anyone have any idea why this might be happening, and how I can prevent it ?