be88ex / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
1 stars 0 forks source link

cannot access all feature objects #267

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a function to delete all placemarks. I can access the first
placemark using getFirstChild()(and I can successfully delete the
placemark), but I cannot access all feature objects as shown using the
following code snippet :

function removeAllPlacemarks(){

  var feature=ge.getFeatures().getFirstChild();
  var name=feature.getName();
  var type=feature.getType();
  alert("first child name="+name+" type = "+type);
  ge.getFeatures().removeChild(feature);

  var features=ge.getFeatures().getChildNodes();
  var len=features.getLength();

  alert("In removeAllPlacemarks #features="+len);

  for ( var i=0; i<len; i++ ){

    alert("In loop for feature="+i);

    name=features.item[i].getName()

    alert("after access of feature "+i);

  }

}

Original issue reported on code.google.com by paking2...@rogers.com on 13 Jun 2009 at 6:00

GoogleCodeExporter commented 8 years ago
The correct usage is features.item(i)   Note the use of parentheses vs. square 
brackets.

Next time please ask in the developer forum to confirm it is a bug and not an 
error in 
your code. Thanks!

Original comment by api.roman.public@gmail.com on 17 Jun 2009 at 11:38