setting properties externally

  • Hello everyoe, I was wondering if there was a way to communicate with the build files externally like changing the image url here.

    For example

    Code
    <script src="swfobject/swfkrpano.js"></script>
      <div id="container">
      	<div id="panoDIV" style="height:100%;">
        	<script>
    
    
          	embedpano({target:"panoDIV",swf:"build.swf"});
        	embedpano.set(hotspot[0].url, "www.website.com/1.jpg");
       	//change the hotspot image here
        	</script>

    Thank you!

  • Hi,

    to set variables during embedding you need to use either the 'vars' object:
    https://krpano.com/docu/html/#vars

    or the createPanoViewer() function and the addVariable() function:
    https://krpano.com/docu/html/#addvariable

    e.g.

    Code
    var viewer = createPanoViewer({target:"panoDIV",swf:"build.swf"});
    viewer.addVariable("hotspot[NAME].url", "1.jpg");
    viewer.embed();

    (Note - always use names when addressing elements, just 'hotspot[0]' is not recommend unless you really know what you do!)

    If you were looking for dynamic changing images from external, have a look at the Javascript Interface:
    https://krpano.com/docu/js/#top

    Best regards,
    Klaus

  • Hi,

    What if I use

    embedpano({target:"panoDIV",swf:"build.swf"});

    How do addVariables() through that?

    First note - createPanoViewer() and embedpano() is technically exactly the same!
    When you want to use addVariable(), then simply use the createPanoViewer() function!

    For embedpano() you need to use a Object which stores the variables,
    e.g.

    Code
    var variables = {};
    variables["hotspot[NAME].url"] = "1.jpg";
    embedpano({target:"panoDIV",swf:"build.swf", vars:variables });

    Best regards,
    Klaus

  • Unfortunately... that did not work...

    I don't even get errors in my console. I was actually hoping to get them since I don't have the hotspot names right and the images like 1.jpg isn't there.

    However it just ignores the variables part.

    Is there a simple test to see if there's any way possible I can communicate with the tour through javascript? I have made no progress with communicating anything to it at all. I would like to see something. Errors would be great. Or is this related to Kolor PTP program? I have a real license.

    I downloaded the examples from the javascript interface documentation and I get a text "license error" on my local and online server. (I might post a thread on this later or something, please ignore this for now)

    Thank you

  • Hi,

    Or is this related to Kolor PTP program?

    yes, it can be related to used xml structure of course!
    the variables in that examples are passed only to the first loaded xml/pano,

    maybe try working directly with krpano to understand how it is working, then passing any variables shouldn't be a problem...

    I downloaded the examples from the javascript interface documentation and I get a text "license error" on my local and online server. (I might post a thread on this later or something, please ignore this for now)

    have you copied the krpano.license to the folder of the krpano.swf?

    best regards,
    Klaus

  • Hi Klaus again, thank you for replying to my questions

    I'm currently using Kolor Pantour Pro 1.8 to generate my swf,xml, and html files. Should I use the actual
    krpano Tools 1.0.8.15
    ?
    In my build.xml, it has

    Code
    <!-- Generated By Kolor Panotour 1.8.0 -->
    <krpano version="1.0.8.14" logkey="false">

    I only have build.xml and build0.xml, both files of course load first.

    Build0.xml has the hotspot properties I want to control

    Code
    <hotspot name="spot0" onclick="closeallobjects();if(flying == 1.0, flyback(spot0), flyout(spot0) );" 
    url="builddata/graphics/spots/spot0.png" distorted="true" ath="44.0311" atv="-5.2106" width="84"
     height="8" flying_width="728" flying_height="90" backup_width="84" backup_height="8" flying="0" 
    backup_rx="20.4057" backup_ry="0.409675" backup_rz="-2.24183" rx="20.4057" ry="0.409675" rz="-2.24183" />

    If so, I probably would like to leave that as a last resort... However, is this the right forum to this question? I JUST realized that this website isn't where I got the kolor pano program from....

    Sorry.

  • Hi,

    I'm currently using Kolor Pantour Pro 1.8 to generate my swf,xml, and html files. Should I use the actual
    krpano Tools 1.0.8.15

    when you want to use the 'vars' object, yes, then just you use the latest krpano viewer and embedding files.


    Build0.xml has the hotspot properties I want to control

    when that 'build0.xml' is the first pano, then it should work,
    btw - your hotspot is named 'spot0' - have you used that name when trying to set the url?

    best regards,
    Klaus

  • Solved.
    The code always did work, but I didn't specify my domains inside Kolor 1.8 to allow the javascript to communicate with the variables.

    Thanks for your help everyone!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!