Google Earthのコールバックを機能させようとしていますが、起動していないようです。Google Earth APIサイトのビュー変更例を参照として使用しましたが、コードとの違いはわかりません...それでも私のものは機能しません!
これが私のコードの重要な部分です:
<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
document.getElementById('map3d').innerHTML = '';
google.earth.createInstance('map3d', initCallback, failureCallback);
}
function initCallback(pluginInstance) {
ge = pluginInstance;
ge.getWindow().setVisibility(true);
// add a navigation control
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
// Set the FlyTo speed.
ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
// add some layers
//ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
//ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
throw (new Error("InitCallback!"));
google.earth.addEventListener(ge.getView(), 'viewchange', function () {
throw (new Error("EVENT!"));
});
}
function failureCallback(errorCode) {
}
</script>
「InitCallback!」エラーは正しくスローされますが、「EVENT!」が表示されません。エラーがスローされました-地球をどれだけ動かしても。
誰かが私が間違っていることを見ていますか?どんな助けでも大歓迎です!