You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, January 30th 2011, 12:07am

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

2

Tuesday, February 1st 2011, 11:06am

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

3

Wednesday, February 2nd 2011, 12:07am

implementing scenetoload

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

4

Thursday, February 3rd 2011, 2:51pm

Hi,

add the passQueryParameters() function to pass the html parameters to krpano,
e.g.

Source code

1
2
3
4
var viewer = createPanoViewer({swf:"krpano.swf"});
viewer.addVariable("xml", "krpano.xml");
viewer.passQueryParameters();
viewer.embed("panodiv");


best regards,
Klaus

5

Thursday, March 17th 2011, 1:41pm

Loading different scenes via html - loading plugins

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

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

6

Thursday, March 17th 2011, 1:43pm

Add your plugins to <krpano> tag directly
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

7

Thursday, March 17th 2011, 2:12pm

loading default scene

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

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

8

Thursday, March 17th 2011, 2:31pm

scenetoload = "null" is not right. it has to be == or != check the documantation tab at the top and find the 'IF' section

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

9

Thursday, March 17th 2011, 2:38pm

Hi Tim,

Source code

1
2
3
4
5
6
<action name="startup">
if(scenetoload === null, set(scenetoload,pano1));

loadscene(get(scenetoload),merge,blend(4));

</action>


Have a look here:
if(condition, then-actions, else-actions*) action and set(variable,value) action.

SAlut.

10

Thursday, March 17th 2011, 3:30pm

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

11

Thursday, March 24th 2011, 12:16am

Sorry, my question was because of my blindnes :) After 15 hours in work no big surprise :) I found my error and removed my question.