error: exception in animation handler for: onEnd

6671
11
04-09-2012 07:59 AM
danbecker
Occasional Contributor III
In firebug, I get this error when I zoom to the visibility scale of the 'props' layer:

exception in animation handler for: onEnd...?v=2.8 (line 14)
TypeError: _69.color is Null...Legend.xd.js (line 19)


If I remove the props layer from both the map and legend objects, the error is gone.

Here's what I have:

dojo.addOnLoad(init);
var mapLayers = [];
var legendLayers = [];
  
//Function to initialize the map and read data from Configuration file
function init() {
        setupFindTask();
        //asp.net proxy page for token service
        esri.config.defaults.io.proxyUrl = "proxy.ashx";
        //change the location of the map slider
 esri.config.defaults.map.slider = { left:"13px", top:"76px", width:null, height:"150px" };
 //change zoom options to try and get map to display faster
 esri.config.defaults.map.zoomRate = 50;
 esri.config.defaults.map.zoomDuration = 1000;

 dojo.connect(map, "onLoad", mapLoaded);
 dojo.connect(grid1, "onRowClick", onRowClickHandler);

 //lets grab the details from the config.txt file  
 dojo.xhrGet({
        url: "Config.txt",
        handleAs: "json",
        preventCache: true,
        load: function (responseObject, ioArgs) {
                var mapExtent = responseObject.DefaultExtent;
                defaultID = responseObject.defaultID;
  defaultFacName = responseObject.defaultFacName;
  defaultFacCityState = responseObject.defaultFacCityState;                    
     
  var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]),
                                        parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), new esri.SpatialReference({ wkid: 102100}));
     
     
  dojo.byId('imgApp').src = responseObject.ApplicationImage;
                dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName;     
          
         map = new esri.Map("map", { extent: startExtent});     
     
  createBasemapGallery();
  
  dojo.connect(map, "onLoad", MapInitFunction);
                }
 });
}
 
//map layers can be added here
function MapInitFunction(map) {
        var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
         mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
  id: 'facils',
         outFields:["*"]
       });
 legendLayers.push({layer:facils,title:"Facilities"});
  
 var bndry = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/3",{
        mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
  id: 'bndry',
  opacity: 0.7,
         outFields:["*"]
       });
 legendLayers.push({layer:bndry,title:"Boundary"});
  
 var props = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/2",{
        mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
  id: 'props',
         outFields:["*"]
       });
 legendLayers.push({layer:props,title:"Property Boundaries"});

 dojo.connect(map,'onLayersAddResult',function(results){
  var legend = new esri.dijit.Legend({
   map:map,
                        layerInfos:legendLayers
           },"legendDiv");
                 
                 //when the map extent is changed, refresh legend layers since layerInfos is used in legend constructor
  dojo.connect(map, "onExtentChange", function(){
   legend.refresh();
  });
 legend.startup();
        });

        map.addLayers([bndry,props,facils]);
  
 dojo.connect(map,'onLayersAddResult',function(results){
  //add check boxes
  dojo.forEach(legendLayers,function(layer){
   var layerName = layer.title;
   var checkBox = new dijit.form.CheckBox({
    name: "checkBox" + layer.layer.id,
                      value: layer.layer.id,
                      checked: layer.layer.visible, 
    onChange: function(evt) {
     var clayer = map.getLayer(this.value);
     clayer.setVisibility(!clayer.visible);
     this.checked = clayer.visible;
     }
    });
     
          //add the checkbox and label to the toc
          dojo.place(checkBox.domNode,dojo.byId("toggle"),"after");
          var checkLabel = dojo.create('label',{'for':checkBox.name, innerHTML:layerName},checkBox.domNode,"after");
          dojo.place("<br />",checkLabel,"after");
     
  });
 });
   
}


anyone see this problem before?

edit: The problem seems to start at v2.7; changing to v2.5 or v2.6 there is no error, and everything works fine.
0 Kudos
11 Replies
JeffPace
MVP Alum
I am guessing your props layer is poly's with null fill.  I wonder if that is causing the bug.  Try going to the Legend of the rest service directly and see if you get the error in firebug.



In firebug, I get this error when I zoom to the visibility scale of the 'props' layer:

exception in animation handler for: onEnd...?v=2.8 (line 14)
TypeError: _69.color is Null...Legend.xd.js (line 19)


If I remove the props layer from both the map and legend objects, the error is gone.

Here's what I have:

dojo.addOnLoad(init);
var mapLayers = [];
var legendLayers = [];
  
//Function to initialize the map and read data from Configuration file
function init() {
        setupFindTask();
        //asp.net proxy page for token service
        esri.config.defaults.io.proxyUrl = "proxy.ashx";
        //change the location of the map slider
 esri.config.defaults.map.slider = { left:"13px", top:"76px", width:null, height:"150px" };
 //change zoom options to try and get map to display faster
 esri.config.defaults.map.zoomRate = 50;
 esri.config.defaults.map.zoomDuration = 1000;

 dojo.connect(map, "onLoad", mapLoaded);
 dojo.connect(grid1, "onRowClick", onRowClickHandler);

 //lets grab the details from the config.txt file  
 dojo.xhrGet({
        url: "Config.txt",
        handleAs: "json",
        preventCache: true,
        load: function (responseObject, ioArgs) {
                var mapExtent = responseObject.DefaultExtent;
                defaultID = responseObject.defaultID;
  defaultFacName = responseObject.defaultFacName;
  defaultFacCityState = responseObject.defaultFacCityState;                    
     
  var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]),
                                        parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), new esri.SpatialReference({ wkid: 102100}));
     
     
  dojo.byId('imgApp').src = responseObject.ApplicationImage;
                dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName;     
          
         map = new esri.Map("map", { extent: startExtent});     
     
  createBasemapGallery();
  
  dojo.connect(map, "onLoad", MapInitFunction);
                }
 });
}
 
//map layers can be added here
function MapInitFunction(map) {
        var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
         mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
  id: 'facils',
         outFields:["*"]
       });
 legendLayers.push({layer:facils,title:"Facilities"});
  
 var bndry = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/3",{
        mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
  id: 'bndry',
  opacity: 0.7,
         outFields:["*"]
       });
 legendLayers.push({layer:bndry,title:"Boundary"});
  
 var props = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/2",{
        mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
  id: 'props',
         outFields:["*"]
       });
 legendLayers.push({layer:props,title:"Property Boundaries"});

 dojo.connect(map,'onLayersAddResult',function(results){
  var legend = new esri.dijit.Legend({
   map:map,
                        layerInfos:legendLayers
           },"legendDiv");
                 
                 //when the map extent is changed, refresh legend layers since layerInfos is used in legend constructor
  dojo.connect(map, "onExtentChange", function(){
   legend.refresh();
  });
 legend.startup();
        });

        map.addLayers([bndry,props,facils]);
  
 dojo.connect(map,'onLayersAddResult',function(results){
  //add check boxes
  dojo.forEach(legendLayers,function(layer){
   var layerName = layer.title;
   var checkBox = new dijit.form.CheckBox({
    name: "checkBox" + layer.layer.id,
                      value: layer.layer.id,
                      checked: layer.layer.visible, 
    onChange: function(evt) {
     var clayer = map.getLayer(this.value);
     clayer.setVisibility(!clayer.visible);
     this.checked = clayer.visible;
     }
    });
     
          //add the checkbox and label to the toc
          dojo.place(checkBox.domNode,dojo.byId("toggle"),"after");
          var checkLabel = dojo.create('label',{'for':checkBox.name, innerHTML:layerName},checkBox.domNode,"after");
          dojo.place("<br />",checkLabel,"after");
     
  });
 });
   
}


anyone see this problem before?

edit: The problem seems to start at v2.7; changing to v2.5 or v2.6 there is no error, and everything works fine.
0 Kudos
danbecker
Occasional Contributor III
I am guessing your props layer is poly's with null fill.  I wonder if that is causing the bug.  Try going to the Legend of the rest service directly and see if you get the error in firebug.


correct; props is poly outline with 'no color' fill in the .mxd.

I looked at the rest MapServer/legend and it displayed correctly.

It's weird; it works fine in v2.5 or v2.6. I can't test < 2.5 because props is a secured layer (identityManager)

edit: Your def. onto something here though. I added fill to the poly in the .mxd, cleared /rest cache, restarted service, changed to v2.8 and no error in firebug and everything worked fine. So, for me, looks like it's v2.6 for now.
0 Kudos
JeffPace
MVP Alum
Very odd. I have many layers like that, but not in a feature layer, at 2.7 (2.8 NOT AVAILABLE LOCAL YET)
0 Kudos
KellyHutchins
Esri Frequent Contributor
Jeff,

The 2.8 download was added late last week - you can download it here:
http://resources.arcgis.com/content/web/arcgis-javascript-api-download




Very odd. I have many layers like that, but not in a feature layer, at 2.7 (2.8 NOT AVAILABLE LOCAL YET)
0 Kudos
YvanBérard
Occasional Contributor
I am having this exact same problem.

firebug error 1: exception in animation handler for: onEnd /jsapi...is/3.4/ (line 15 )
firebug error 2: TypeError: this._rootLayerNode is undefined (781 out of range 34) /jsapi...is/3.4/ (line 781)

I'm using the JS api v.3.4

It seems that when it happen, my ArcGISTiledService does not refresh the new scale images and they are all blurry on the screen.

But what is weird, is that it doesn't always happen. It seems to be random.

Here is where you can test it: http://www.jpcadrin.ca/Carto/?id_mun=42025&matricule=2036-94-5034

Thank you for your help.
0 Kudos
ÉricGosselin
Esri Contributor
Try using setTimeout to add some delay
0 Kudos
YvanBérard
Occasional Contributor
This workaround (with the setTimeout) seems to work.

Thanks!
0 Kudos
AdrianMarsden
Occasional Contributor III
Hi

I'm getting a similar issue - just been told we are finally planning on our XP - Win 7 upgrade so testing my app on IE10

I get

exception in animation handler for:onEnd 
RangeError: Array length must be a finite positive integer


I'm using 3.5 of the API and ArcGIS server 10.1 SP1 so all up to date

Cheers

ACM
0 Kudos
AdrianMarsden
Occasional Contributor III
no-one have any ideas about this, our clock is ticking and I need to get my app working in IE10

It must be something I have added recently that has caused this as earlier versions of my app worked in IE10 - but there's about 3 months of changes I'll have to pick through - if anyone has any pointers it would be appreciated.
0 Kudos