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.

    Edited once, last by sg63 (August 24, 2012 at 6:27 PM).

  • 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.

    Code
    tour.html?startscene=third_scene

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

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

    Best regards,
    Klaus

  • Hi,

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

    Here a snippet:

    Code
    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

  • 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>

Participate now!

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