AnsweredAssumed Answered

Creation of a second 3D Scene after some seconds fails

Question asked by m.reiprechtconterra-de-esridist Employee on Feb 28, 2016

In the attached Sample (map.html) following code is executed:

 

var view1 = create3DView("view1Div");
 view1.then(function() { 
     setTimeout(function() { 
            view1.destroy(); 
            setTimeout(function(){ 
                 var view2 = create3DView("view2Div"); 
            },1000); 
     },1000);
 });

 

 

This should simulate an effect I observed by implementing a 2D/3D Switch. If I switch from 3D to 2D and then back to 3D the creation of the second 3D view fails with the error message "Uncaught TypeError: Cannot read property 'currentCamera' of null" in SceneView.js:1253.

The sample map.html simulates the behavior by creation of a 3D View (view1), destruction of the view1 after 1 second and after a second it tries to create a new 3D view (view2), which produces the error.

 

Please Note: if I directly create second 3D View, without the wait for the first or with shorter timeouts then it works. In the sample above it is not important if I destroy the view1. The error happens also If I just try to create a second 3D View after some seconds.

 

I'm not sure if I do anything wrong here or if this is a bug? Is there a workaround for the problem? Or has somebody else observed this behavior?

Attachments

Outcomes