Google Earth API Samples - viewchange Event (and viewchangebegin, viewchangeend)

Last Modified:
06/08/2009
Installed Plugin Version:
...

viewchangeend Count: 0

Relevant Resources:

Relevant Code Excerpt:

var vceCount = 0;
var vcTimeout = null;

google.earth.addEventListener(ge.getView(), 'viewchange', function() {
  document.getElementById('vc-indicator').style.visibility = 'visible';
  
  if (vcTimeout !== null)
    window.clearTimeout(vcTimeout);

  // hide the 'view changed' message after 250 ms of
  // inactivity
  vcTimeout = window.setTimeout(function() {
    document.getElementById('vc-indicator').style.visibility = 'hidden';
    vcTimeout = null;
  }, 250);
});

google.earth.addEventListener(ge.getView(), 'viewchangeend', function() {
  vceCount++;
  document.getElementById('vce-counter').innerHTML = vceCount;
});