Button to select the last panorama that was viewed

  • Hi All

    I know there is actions to automate next and previous scenes - and thats great.... but what about "go back to the last panorama that I viewed please, not the scene numbered lower but the last one I viewed"

    Ideas - cheers

    John

  • what about "go back to the last panorama that I viewed please, not the scene numbered lower but the last one I viewed"
    John


    I had written this in javascript a while back when I was trying to make the browser back button work with krpano, so it was a simple matter to recode this into xml actions. These actions will support a complete history of panos viewed in a given session and allow you to go back or forward through the panos visited in a manner similar to your browser's back and foward buttons.

    There are three actions which are used to support back and forward buttons: hist_new(), hist_back(), and hist_forward(). To make this work, whenever a pano is loaded, you need to run hist_new(). I put this function in the events.onxmlcomplete action. Then create two plugins for buttons named back_button and forward_button. Set the onclick for these plugins to hist_back() and hist_forward() respectively. Note that this example uses the buttons.jpg that is found in the skin directory for the krpano release as well as the hotspot_ani_white.swf animated hotspot (but neither are required to integrate into your tour).

    This code was not written to work with scenes. It relies on the xml.url changing. I suspect that it would be easy to modify for scenes, but I really don't have any experience with them, so I'll leave that to someone else.

    Here's a (hopefully) working example. You'll need to copy and paste the following three code sections into three separate files named history1.xml, history2.xml, and history3.xml. In your html use the swf.addVariable('xml', 'history1.xml'); to load the history1.xml and then use the hotspots to navigate around. You'll note that a back button will appear in the upper left hand.corner. If you navigate back then the forward button appears.

    First file named history1.xml (this contains the history actions and the plugins for the back and forward buttons):

    Second file named history2.xml:


    Third file named history3.xml:


    Hope this meets your needs!

    steve

Participate now!

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