tags:

views:

18

answers:

0

I want to use Google Earth for a presentation. I want to start with rotating the globe, and after a while zoom in to a certain location. The rotating stuff works, but somehow the zoom doesn't. I have the following code


      var ge;
      google.load("earth", "1");
      function init() {
         google.earth.createInstance('map', initCB, failureCB);
      }
    function initCB(instance) {
        ge = instance;
        ge.getWindow().setVisibility(true);

        ge.getNavigationControl().setVisibility(ge.VISIBILITY_HIDE);

        var oldFlyToSpeed = ge.getOptions().getFlyToSpeed();
        ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);

        var moveCamera = function(count) {
            var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
            lookAt.setLatitude(lookAt.getLatitude() + .1);
            lookAt.setLongitude(lookAt.getLongitude() + 5);
            ge.getView().setAbstractView(lookAt);

            if (count < 215) {
                setTimeout(function() {
                    moveCamera(count + 1);
                }, 150);
            } else {
                ge.getOptions().setFlyToSpeed(oldFlyToSpeed);
                loadRoute();
        }
        var loadRoute = function(){
            ge.getOptions().setFlyToSpeed(0.1); 

            var la = ge.createLookAt('');
            la.set(12, -84, 5000, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 750000);
            ge.getView().setAbstractView(la);
        };
    };
    moveCamera(0);
    document.getElementById('installed-plugin-version').innerHTML =
        ge.getPluginVersion().toString();
    }
    function failureCB(errorCode) {
    }

I know the peace of code in loadRoute(); works, because i tested that before.

Does anybody know what goes wrong here?