Pass variable from HTML to XML

  • Hi,
    I'm attempting to pass a variable from html to xml, but I'm not having much success. I call the html with a query string containing my variable like this:

    Code
    http://website.com/index.html?viewmode=external

    index.html contains this code for setting up the pano:

    Code
    <script type="text/javascript">
       var swf = createswf("krpano.swf");
       swf.addVariable("xml","pano.xml");
       swf.passQueryParameters();
       swf.embed("pano");
    </script>

    pano.xml contains code in an action to trace the value of the variable when a hotspot is clicked:

    Code
    <action name="tracelog">
       trace('viewmode=',viewmode);
       showlog();
    </action>

    The log just shows "viewmode=viewmode". I'm not using kprotect. Any ideas?

    Einmal editiert, zuletzt von Andrew (29. November 2010 um 05:49)

  • I was lucky with this solution until the latest krpano version:

    Code
    <script type="text/javascript">
    
    
    	var swf = createswf("krpano.swf");
    	swf.addVariable("xml","srebrenica_pillar-of-shame1_berlin-2010_4000h.xml");
    	swf.addVariable("startPano", "start");
    	swf.embed("krpanoDIV");
    
    
    </script>

    With the new Krpano, the HTML looks a bit different, and it seems that this does not work (startPano is now NULL). Any solution for this as well?

    Code
    <script>
    		embedpano({swf:"hauptdeck_buffetlift_2.swf", xml:"hauptdeck_buffetlift_2.xml", target:"pano", startPano:"start"});
    	</script>
  • Hi,

    The log just shows "viewmode=viewmode". I'm not using kprotect. Any ideas?

    the code is correct and should work, the swf.passQueryParameters();

    call should pass all given parameters to variables...
    do you have a link to the not working example?

    With the new Krpano, the HTML looks a bit different, and it seems that this does not work (startPano is now NULL). Any solution for this as well?

    you can still use the old createswf() function,
    the embedpano() is just an additional simplified single-line function when not parameters or further settings are needed, custom parameters can't be used with it,

    see here for more details about the functions and their usage:
    https://krpano.com/docu/swfkrpanojs/#syntax
    https://krpano.com/docu/swfkrpanojs/#description

    best regards,
    Klaus

  • Ah, thank you very much! I'll try!

    you can still use the old createswf() function,
    the embedpano() is just an additional simplified single-line function when not parameters or further settings are needed, custom parameters can't be used with it,

    see here for more details about the functions and their usage:
    https://krpano.com/docu/swfkrpanojs/#syntax
    https://krpano.com/docu/swfkrpanojs/#description

    best regards,
    Klaus

    edit: I succeeded using this code now, thank you for pointing me to the right function:

    Einmal editiert, zuletzt von mstoss (6. Dezember 2010 um 09:39)

Jetzt mitmachen!

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