You are not logged in.

1

Tuesday, November 29th 2011, 7:25pm

Loading the last scene on startup, not the first?

Hi there.

My virtual tour is currently set up to load the first scene in the array. However as I'm in the process of documenting my scenes, I want it to load the last scene in the array (the latest one added), so I can work on the hotspot of the scene immediately without having to navigate all the way through my tour.

The current code is:

Source code

1
2
3
4
	<action name="startup">
		<!-- load the first scene -->
		loadscene(get(scene[0].name), null, MERGE);
	</action>


I've tried replacing the line with:

Source code

1
2
		<!-- load the first scene -->
		loadscene(get(scene[scene.count].name), null, MERGE);


But to no avail.

Does anyone have the correct code? I'm probably missing something easy. Thanks in advance. *thumbsup*


Edit: also, does anyone have any tips on adding a "previous scene" button? I wouldn't know how to reference the last scene I was on :\.

This post has been edited 1 times, last edit by "MB94" (Nov 29th 2011, 8:56pm)


mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

2

Wednesday, November 30th 2011, 1:43am

Hi!
Scenes index from 0
so if 6 scene then last one be 5 ( 0 - 5 )
You need to sub(count,1); to get last scene index

Regards
Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

3

Sunday, December 4th 2011, 11:58pm

sub(count,1);


Thank-you for your reply, however I'm still having trouble getting it to work. I replace the line with this:

Source code

1
loadscene(get(scene[sub(scene.count,1);].name), null, MERGE);


But the tour gets a null-pointer error, reference:

Source code

1
2
WARNING: not local trusted - ExternalInterface disabled!
ERROR: loadscene() - scene "null" not found


Do you have any ideas? Thanks again :).

mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

4

Monday, December 5th 2011, 12:48am

Hi!
You can't use action as parametr.
so make some variable
set(var,get(scene.count)); <!-- create some variable -->
sub(var,1);
loadscene(get(scene[get(var)].name), null, MERGE);

Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

5

Monday, December 5th 2011, 2:47pm

Hi!
You can't use action as parametr.
so make some variable
set(var,get(scene.count)); <!-- create some variable -->
sub(var,1);
loadscene(get(scene[get(var)].name), null, MERGE);

Andrey *thumbup*


That works perfectly thank-you!

Do you also know how to reference the previous scene I was one? I want to make a back button that I can keep clicking no matter how far I am in the tour, and it eventually takes me back to the entrance of my virtual tour. Thanks again *g*

mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

6

Tuesday, December 6th 2011, 2:06am

Hi!
take a look here iPad interface for krpano tours
try to click on prev/next buttons
you mean that?

Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Posts: 1,857

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

7

Tuesday, December 6th 2011, 3:58am

This comes with krpano. Check the examples folder. Scenes with prev/next.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

8

Wednesday, December 7th 2011, 1:58pm

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 <action name="nextscene">
    if(%1 != findnext, set(i,0));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       inc(i);
       if(i == scene.count, set(i,0));
       loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
      ,
       inc(i);
       if(i LT scene.count, nextscene(findnext));
      );
</action>
 
<action name="prevscene">
    if(%1 != findnext, sub(i,scene.count,1));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       dec(i);
       if(i LT 0, sub(i,scene.count,1));
       loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
      ,
       dec(i);
       if(i GE 0, prevscene(findnext));
      );
</action>

Similar threads