So I'm having difficulty doing something that seems rather easy. I know within the krpano, it's easy to put hotspots and move to other hotspots. Well I have a map outside of the krpano and I want to make a javascript call to the krpano to change the scene. Sounds simple, right? I've tried two different strategies, both of which are giving me problems. The first one, loads up a new krpano each time i call selectpano(id):
var viewer;
function selectpano(id){
$('#panoholder').hide();//hide the view while we load the pano
$('#viewport').html('');//clear out the krpano object
viewer = createPanoViewer({swf:"includes/krpano.swf", xml:"includes/panos-fla-kiosk.xml", target:"viewport"});
if (viewer.isHTML5possible() ){
viewer.useHTML5("always");
viewer.embed();
document.getElementById("krpanoSWFObject").set('scenename','scene_'+id);
}
//wait a second for it to load and then show it
setTimeout(function(){$('#panoholder').show();},1000);
}
Display More
This seems to not be good after a while of navigating from pano to pano to pano. It just gets bogged down and slows significantly after extended use. So I tried another method. This one keeps the same krpano, but just changes the scene within it. *Conceptually* this seems like it's more light weight:
function selectpano(id){
$('#viewport').hide();
//the krpanoSWFObject was already initialized onload
document.getElementById("krpanoSWFObject").call('lookto(0,0,get("view.fov")); loadscene("scene_'+id+'", null, MERGE); wait(LOAD); js(showpano("'+id+'"));');
}
function showpano(id){//this is called after the scene has loaded, so show the pano now
$('#viewport').show();
}
Display More
But I get the same problem here. In the beginning it takes about 4-5 seconds to load the pano on the selectpano(id) call. Each subsequent call of that function for a different pano slows the load time until, ultimately, the showpano() (the function that gets called after the loadscene call is completed, never gets called.
Can somebody help me? It seems that changing scenes via javascript should be a very fundamental and easy thing to accomplish. What am I doing wrong? Has anybody else run into this problem before?