You are not logged in.

1

Monday, August 13th 2012, 10:40pm

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

Source code

1
2
3
4
5
6
7
8
9
  <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!

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Tuesday, August 14th 2012, 12:00am

Of course except your syntax is off, its krpano.call. See the docs for the full syntax or the examples folder for working projects.
And var krpano = document....
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Wednesday, August 15th 2012, 2:25pm

Hi,

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

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

e.g.

Source code

1
2
3
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:
http://krpano.com/docu/js/#top

Best regards,
Klaus

4

Wednesday, August 15th 2012, 9:11pm

What if I use

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

How do addVariables() through that?

5

Thursday, August 16th 2012, 12:16pm

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.

Source code

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


Best regards,
Klaus

6

Thursday, August 16th 2012, 5:17pm

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

7

Thursday, August 16th 2012, 5:33pm

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

8

Thursday, August 16th 2012, 9:40pm

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

Source code

1
2
<!-- 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

Source code

1
2
3
4
	<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.

9

Friday, August 17th 2012, 9:52am

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

10

Wednesday, August 22nd 2012, 8:20pm

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!