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

Thursday, August 23rd 2012, 7:28pm

Load scene from HTML other than the default

Hi.

I'm working on a large tour and it's more convenient for people to have the choice to "jump in" at specific scenes rather than at the start so I plan to have a normal HTML landing page which links to the different starting points.
So if the default opening scene is, say, "the_first_scene", I'd like to create an HTML page which actually starts at "the_fifth_scene".
How can I do this?
My coding skills are limited so if you could assume I'm stupid when you reply, I'd be grateful *smile*

Thanks.

--EDIT--
Just re-read this and realised that I've not really made myself clear: I lack the terminology to describe what I need, I think...

I want to use just one xml file, the main xml file that the main tour uses, the one that is created by the Create Tour droplet and similar to the examples such as "demotour-corfu" in the main krpano dwnload.

So, in the xml I might have:
<scene name="first_scene" >
...etc..
</scene>

<scene name="second_scene" >
...etc..
</scene>

<scene name="third_scene" >
...etc..
</scene>

<scene name="fourth_scene" >
...etc..
</scene>

<scene name="fifth_scene" >
...etc..
</scene>

<scene name="sixth_scene" >
...etc..
</scene>

...and so on.

But I'd like to send the user to the fifth_scene by writing it in the HTML so when they start the tour, they're starting at the 5th scene, not the default one as in the xml. (There will be around 10 different possible starting points for this tour and not all are relevant to the people who will be using it, hence the need for different start scenes.)

From what I can tell, it might be possible to do this by changing the startscene at the embed stage in the HTML so that the startup action (below) does the rest of the work:

<action name="startup">
if(startscene === null, copy(startscene,scene[0].name));
loadscene(get(startscene), null, MERGE);
</action>

But my understanding of the code needed is woefully lacking.

Again, thanks to anyone who can help.

This post has been edited 1 times, last edit by "sg63" (Aug 24th 2012, 6:27pm)


2

Wednesday, August 29th 2012, 8:55am

Hi,

the default vtour xml example code has that feature already integrated - the 'startscene' variable,

you could simply use a link to the html page and set that 'startscene' variable there, e.g.

Source code

1
tour.html?startscene=third_scene


an other possiblity would be setting the 'startscene' variable directly in the html file, e.g.

Source code

1
embedpano({....., vars:{startscene:"third_scene"});


Best regards,
Klaus

3

Saturday, September 22nd 2012, 2:20pm

That's great, thanks; that's exactly what I wanted. Apologies for the late reply!

Posts: 148

Location: Italy

Occupation: Freelance Fotographer

  • Send private message

4

Thursday, April 3rd 2014, 12:33pm

hi, is it possible to set automaticaly startscene variable equal to name of html file? in otherword, if html file name is name.html then startscene is equal to 'name'?

in this way i can use scene name to rename the html file without to edit each html file for each scene.

5

Thursday, April 3rd 2014, 3:53pm

Hi,

yes, that's possible of course - but that's more a job for Javascript than for the krpano viewer .

Here a snippet:

Source code

1
2
3
4
5
var url = window.location.pathname.toLowerCase();
var ext = url.lastIndexOf(".html");
var basename = url.slice(url.lastIndexOf("/",ext)+1, ext);

embedpano({..., vars:{startscene:basename}});


Best regards,
Klaus

Posts: 148

Location: Italy

Occupation: Freelance Fotographer

  • Send private message

6

Friday, April 4th 2014, 12:06am

thanks Klaus! Great support....

p.s. is possible to use relative path for xml file with embedpano function?


this doesn't working. my html file are into a directory child of principal directory (where are tour.xml)
<script>
embedpano({swf:"../tour.swf", xml:"../tour.xml", target:"pano", html5:"auto", vars:{startscene:"scene_Ascensore_Chiuso"}, bgcolor:"#FFFFFF", passQueryParameters:true});
</script>

7

Tuesday, April 8th 2014, 7:39pm

Hi,

yes, relative paths should be no problem.

When some paths are not working, check in the Browsers developer tools the network requests to make sure that the paths itself are correct and loadable.

Best regards,
Klaus

Posts: 148

Location: Italy

Occupation: Freelance Fotographer

  • Send private message

8

Wednesday, April 9th 2014, 8:15pm

thanks klous! my problem was that i haven't set relative path also for krpano.js!!! so sorry for my stupid question! and thanks again for javascript code. works great!!!