Wondering if someone can help me with SWFAddress and krpano. I've got the Back & Forward browser buttons to jump to next and previous panos, but a page reload (Ctrl+R or F5) on a deep link address causes the initial pano to load but with the deep link address in the address bar. E.g. I may have followed a hotspot in a pano (scene1) that takes me to another pano (scene2) and the browser address bar correctly shows http://www.site.com/#/scene2 . However, if I reload the page, krpano shows scene1 with the address bar showing http://www.site.com/#/scene2. And, if I paste the URI (http://www.site.com/#/scene2) into the address bar on new tab, the first scene is loaded, not scene2.
Here are a few snippets of code:
Pano XML:
<scene name="scene1">
<view hlookat="-15" vlookat="-10" fov="90" />
<image type="CUBESTRIP">
<cubestrip url="pano1.jpg" />
</image>
<hotspot name="spot2" url="spot2.png" ath="-42" atv="-12" scale="0.6" zoom="true"
onclick="looktohotspot(spot2); js( SWFAddress.setValue(scene2) ); loadscene(scene2, null, MERGE, BLEND(1));" />
</scene>
<scene name="scene2">
<view hlookat="-110" vlookat="8" fov="100" />
<image type="CUBESTRIP">
<cubestrip url="pano2.jpg" />
</image>
<hotspot name="spot3" url="spot3.png" ath="265" atv="0" scale="0.6" zoom="true"
onclick="looktohotspot(spot3); js( SWFAddress.setValue(scene3) ); loadscene(scene3, null, MERGE, BLEND(1));"
/>
</scene>
<scene name="scene3">
etc.
Display More
HTML/Javascript:
<div id="krpano">
<noscript><table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br><br>Javascript not activated<br><br></center></td></tr></table></noscript>
</div>
<script type="text/javascript" src="/swfobject/swfobject.js"></script>
<script type="text/javascript" src="/swfobject/swfkrpanomousewheel.js"></script>
<script type="text/javascript" src="/swfaddress/swfaddress.js"></script>
<script type="text/javascript">
// <![CDATA[
if (typeof(deconcept) !== 'undefined' && deconcept.SWFObjectUtil.getPlayerVersion().major >= 6)
{
var so = new SWFObject("krpano.swf", "krpanoSWFObject", "100%", "100%", "9.0.28","#000000");
so.addParam("allowFullScreen","true");
so.addParam("wmode","transparent");
so.addVariable("pano", "scenes.xml");
so.useExpressInstall("/swfobject/expressinstall.swf");
so.setAttribute("xiRedirectUrl", window.location);
if ( so.write("krpano") ) {
var mousewheelfixes = new SWFkrpanoMouseWheel(so);
var krpanoswf = document.getElementById("krpanoSWFObject");
}
}
else
{
document.getElementById("krpano").innerHTML = '<table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br><br>Adobe Flash Player 9 needed<br><br><br><a href="http://www.adobe.com/go/getflashplayer/" target="_blank"><IMG SRC="http://www.macromedia.com/images/shared/download_buttons/get_flash_player.gif" BORDER="1"></a><br>...click here to download...<br><br><br><br></center></td></tr></table>';
}
function handleChange()
{
if (SWFAddress.getPathNames().length == 0 )
{
// alert("getpathNames=" + SWFAddress.getPathNames()[0] + "\r\nLength=" + SWFAddress.getPathNames().length + "\r\nPath=" + SWFAddress.getPath() );
krpanoswf.call("loadscene(scene1)");
}
else
{
pathindex = SWFAddress.getPathNames().length - 1;
scenetoload = SWFAddress.getPathNames()[pathindex];
// alert("scenetoload=" + scenetoload);
krpanoswf.call("loadscene(" + scenetoload + ")");
}
}
SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);
// ]]>
</script>
Display More
The clumsy IF statement is to get the name portion at the end of the URI to account for paths such as http://www.site.com/region2/scene6.
Interestingly, it works when the alert functions are uncommented, i.e. alert messages are displayed. The javascript console in Firebug reports this error on first load of the page or page reload:
krpanoswf.call is not a function
krpanoswf.call("loadscene(scene1)") line 33
Any suggestions much appreciated.
cheers,
Andrew