From 246ddb2e124e1b0987ba9d5e84b4b09c0beb8f50 Mon Sep 17 00:00:00 2001 From: roblevesque Date: Thu, 7 Jul 2016 11:58:26 -0400 Subject: [PATCH] move JSON load to init() --- mapview/js/mapviewgl.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mapview/js/mapviewgl.js b/mapview/js/mapviewgl.js index 0f6e6f7..36c26e9 100644 --- a/mapview/js/mapviewgl.js +++ b/mapview/js/mapviewgl.js @@ -1,17 +1,3 @@ -// Load Data -var xmlhttp = new XMLHttpRequest(); -var url = "js/empiredata.json"; -var jsonEmpire; - -xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - jsonEmpire = JSON.parse(xmlhttp.responseText); - - } -}; -xmlhttp.open("GET", url, true); -xmlhttp.send(); - if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); var camera, controls, scene, renderer; @@ -28,6 +14,20 @@ render(); function init() { + // Load Data + var xmlhttp = new XMLHttpRequest(); + var url = "js/empiredata.json"; + var jsonEmpire; + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + jsonEmpire = JSON.parse(xmlhttp.responseText); + + } + }; + xmlhttp.open("GET", url, true); + xmlhttp.send(); + scene = new THREE.Scene(); //scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); renderer = new THREE.WebGLRenderer();