An error occurred: viewer.dataSources.removeAll()

I am very confused now. When I try to remove all the czml datasources by using “viewer.dataSources.removeAll()”, there’s an error saying below.

And this error occurs when viewer.dataSources.length>1, meaning that when I add one single czml data file, the method viewer.dataSources.removeAll() work well.

However when I load more czml files and then remove them, there always comes out the Error about the “length” property.

I’ve tried many solutions and I’m really very upset because of this problem.

Could anyone help me out to find a solution to solve this problem? I am really very grateful for your help.


I haven’t seen this error before. Could you put together a Sandcastle example to reproduce this problem?