specifying the scene to load in html and passing to the xml control file

  • Hi

    Just started using krpano. I have multiple scenes in the xml file, ie:

    <scene name="pano1" title="pano1">
    .
    .
    </scene>

    <scene name="pano2" title="pano2">
    .
    .
    </scene>

    Currently I am using loadscene(pano1,merge,blend(4)); to specify the start scene, but what I would like to do is specify the start scene in the html file and pass the varible to the xml file. This way I can have one xml file but several html files each one loading a different start scene.

    I'm sure this is really easy, been searching the forum but cannot find out how to do it, so apologies in advance if i've missed it.

    Thanks

    Tim

  • Hi,

    either use the passQueryParameters() function from the swfkrpano.js script,
    or parse the HTML query string by your own and pass a variable to krpano via the addVariable() function,
    (but note - "pano" and "xml" are reserved variables from krpano, they can't be used)

    then you have the given html parameter in krpano and can use it to load the scene,
    e.g.
    pano.html?scenetoload=pano1
    ...
    loadscene(get(scenetoload),merge,blend(4));

    best regards,
    Klaus

  • Hi Klaus


    Changed xml to be loadscene(get(scenetoload),merge,blend(4));


    but what do I have to change in the html file?


    tried index.html?scenetoload=pano6 but get error loadscene() - scene "null" not found, so obviously the variable 'pano6' is not being passed, do I have to change something in the html file or javascript.


    Please advise


    Thanks

    Tim

  • Thanks again for your help Klaus


    All working now.


    One final question...


    In my example I am defining all my plugins in the pano1 scene and using keep="true" so that they appear in the other scenes.


    <plugin name="t-1"
    align="top" x="-250" y="35"
    url="hotspots/pano5.jpg"
    keep="true"
    onhover="showtext('Hall of Fame',hotspottextstyle);"
    onclick="loadscene(pano6,blend(4));stopsound(sound)"
    />


    This works fine when pano1 is the first scene loaded, but obviously the plugins will not appear if pano2 is loaded instead. Is there a way to define the plugins prior to loading or do I have to define all the plugins in every scene if I want to specify which scene to load via the html variable?


    Thanks


    Tim

  • Thanks for that, just made change and it works fine.


    I'd like to also include setting a default scene if no parameter is passed to krpano, but am struggling with syntax, something like:


    <action name="startup">
    if(scenetoload = "null", set(scenetoload = "pano1"));

    loadscene(get(scenetoload),merge,blend(4));
    </action>


    Any help on the correct syntax would be appreciated.


    Thanks

    Tim

  • Hi Michel


    Many thanks for the 'syntax help' all working fine now, I like this approach as often my clients want to link to individual tours from their own websites, this makes it very straightforward.


    Tim

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!