returns from a hotspot??

  • I am building a tour with 10 standard scenes and ten non-standard scenes, think floorplan with arrows for the first 10. These scenes will have thumbnails showing at the bottom.

    In each of these 10 scenes will be hot spots to one or more of the non-standard scenes that do not have thumbnails. So far this is a no brainer, but what I want to do is have a return button (like standard logo code in each scene, not one occurance that is kept true).

    I want the return button to return the user to the scene that called it, so the called scene needs to know what scene called it.

    Scenes 1 through 10 may have hotspots that will call any combination of scenes 11 to 20.

  • You make it look simple and it probably is.. Within the scene with the hotspot I create a variable, okay is this a simple call? What I have is this


    set(previousscene,scene_11_Ken_Austins_car_Collection)

    <hotspot name="spot2" style="skin_hotspotstyle" ath="-11.609" atv="-1.569" linkedscene="scene_37_ford_roadster" />

    </scene>

    in the hotspot scene (37_ford) I have this as the back button

    <plugin name="logo5" url="back.png" align="righttop" x="35" y="150" onclick="loadscene(get(previousscene), null, MERGE, BLEND(1))"/>


    I get this error


    INFO: krpano 1.0.8.15 (build 2012-10-05)
    INFO: Flashplayer WIN 11.6.602.180 PlugIn
    INFO: registered to: Bill Jones
    WARNING: ExternalInterface NOT available!
    ERROR: loadscene() - scene "null" not found

  • Okay, I'm trying to follow. Should the action be

    <action name="PreviousScene">
    set(PreviousScene,scene_11_Ken_Austins_car_Collection)
    </action>

    and the back button be


    <plugin name="logo5" url="overview2.png" align="righttop" x="35" y="150" onclick="loadscene(get(PreviousScene), null, MERGE, BLEND(1))"/>


    I don't see a missing bracket?

  • Sorry - my mistake - there is no missing bracket.

    I do it in this way.

    1. I always use a function to load new pano/scene eg:

    Code
    <action name="newScene">
        ...
    </action>

    2. I always store the name of the loaded scene

    Code
    <hotspot name="hs1" ... onclick="newscene(scene123)" />
    
    
    <action name="newScene">
        set(activescene, %1);
        loadscene(%1, null, MERGE, BLEND(1));
    </action>

    3. Before you load new scene, you can save the name of active (leaving) scene:

    Code
    <hotspot name="hs1" ... onclick="newscene(scene123)" />
    
    
    <action name="newScene">
        copy(previousScene, activescene);
        set(activescene, %1);
        loadscene(%1, null, MERGE, BLEND(1));
    </action>

    In every moment you can go back calling action newScene(get(previousScene));

    You can also save hlookat, vlookat and fov parameters.

    Working example: http://ai360.pl/projekty/muzeum_gombrowicza/

    Click the camera icon - in fact new panorama loads and by clicking "back" buttom you go back to previous panorama. Previous view parameters are also saved.

  • I appreciate your patience, but today I am brain dead. What I have is a car collection with about 30 scenes that you are on the floor walking around.

    I also have about 40 cars that I have done a drivers view scene for.

    I have hotspot links in the walking tour to different vars, close ones. any drivers view scene can be called from maybe 4 different walking scenes, that's why I want to go back to the originating scene.

    No matter what I try I get a not found error.

    Here are the code snips of a originating scene and the drivers view scene. If you can fix it, or write it the way it should be I can figure it out and do from there.

    Thanks


    <scene name="scene_04_Ken_Austins_car_Collection" title="04_Ken_Austins_car_Collection" onstart="" thumburl="panos/04_Ken_Austins_car_Collection.tiles/thumb.jpg" lat="" lng="" heading="">

    <view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />

    <preview url="panos/04_Ken_Austins_car_Collection.tiles/preview.jpg" />

    <image type="CUBE" multires="true" tilesize="512" progressive="false">
    <level tiledimagewidth="11954" tiledimageheight="11954">
    <cube url="panos/04_Ken_Austins_car_Collection.tiles/l5_%s_%v_%h.jpg" />
    </level>
    <level tiledimagewidth="5977" tiledimageheight="5977">
    <cube url="panos/04_Ken_Austins_car_Collection.tiles/l4_%s_%v_%h.jpg" />
    </level>
    <level tiledimagewidth="2989" tiledimageheight="2989">
    <cube url="panos/04_Ken_Austins_car_Collection.tiles/l3_%s_%v_%h.jpg" />
    </level>
    <level tiledimagewidth="1536" tiledimageheight="1536">
    <cube url="panos/04_Ken_Austins_car_Collection.tiles/l2_%s_%v_%h.jpg" />
    </level>
    <level tiledimagewidth="768" tiledimageheight="768">
    <cube url="panos/04_Ken_Austins_car_Collection.tiles/l1_%s_%v_%h.jpg" />
    </level>
    <mobile>
    <cube url="panos/04_Ken_Austins_car_Collection.tiles/mobile_%s.jpg" />
    </mobile>
    </image>

    <!-- place your scene hotspots here --><!-- events - update logo rotation with pano rotation -->
    <events name="nadirlogorotation"
    onviewchange="if(hotspot[nadirlogo].rotatewithview, set(hotspot[nadirlogo].rotate,get(view.hlookat)) );"
    />
    <!-- nadir logo (distored hotspot) -->
    <hotspot name="nadirlogo"
    url="nadir.png"
    ath="0.000"
    atv="90.000"
    distorted="true"
    scale="1.0"
    rotate="0.0"
    rotatewithview="false"
    onclick="switch(rotatewithview); invalidatescreen();"
    />


    <action name="newScene">
    copy(previousScene, activescene);
    set(activescene, %1);
    loadscene(loadscene(%1, null, MERGE, BLEND(1)));
    </action>


    <hotspot name="spot2" style="skin_hotspotstyle2" ath="88.546" atv="13.280" linkedscene="scene_05_ken_austins_car_collection" />
    <hotspot name="spot3" style="skin_hotspotstyle2" ath="90.513" atv="4.339" linkedscene="scene_01_ken_austins_car_collection" />
    <hotspot name="spot4" style="skin_hotspotstyle2" ath="-45.965" atv="10.325" linkedscene="scene_16_ken_austins_car_collection" />
    <hotspot name="spot5" style="skin_hotspotstyle2" ath="-129.070" atv="9.545" linkedscene="scene_20_ken_austins_car_collection" />
    <hotspot name="spot6" style="skin_hotspotstyle" ath="-115.091" atv="-1.528" linkedscene="scene_15_t_speedster" />
    <hotspot name="spot7" style="skin_hotspotstyle" ath="-97.443" atv="-0.367" linkedscene="scene_69_jaguar_xke" />
    <hotspot name="spot8" style="skin_hotspotstyle" ath="-81.309" atv="-0.806" linkedscene="scene_62_corvette" />
    <hotspot name="spot9" style="skin_hotspotstyle" ath="-58.871" atv="-0.190" linkedscene="scene_55_thunderbird" />
    <hotspot name="spot10" style="skin_hotspotstyle" ath="-35.566" atv="-0.890" linkedscene="scene_48_ford_woody" />
    <hotspot name="spot11" style="skin_hotspotstyle" ath="10.403" atv="3.051" linkedscene="scene_48_mgtc" />
    <hotspot name="spot12" style="skin_hotspotstyle" ath="36.058" atv="3.510" linkedscene="scene_27_t_rat_rod" />
    <hotspot name="spot13" style="skin_hotspotstyle" ath="54.076" atv="3.044" linkedscene="scene_27_t_roadster_zypher" />
    <hotspot name="spot14" style="skin_hotspotstyle" ath="70.590" atv="0.735" linkedscene="scene_31_modified_ford_roadster_pu" />
    <hotspot name="spot15" style="skin_hotspotstyle" ath="78.331" atv="0.693" linkedscene="scene_27_t_street_rod" />
    <hotspot name="spot16" style="skin_hotspotstyle" ath="111.635" atv="0.263" linkedscene="scene_44_ford_jeep" />
    <hotspot name="spot17" style="skin_hotspotstyle" ath="123.567" atv="0.535" linkedscene="scene_31_american_austin" />


    </scene>


    <scene name="scene_69_Jaguar_XKE" title="69 Jaguar XKE" onstart="" thumburl="panos/69_Jaguar_XKE.tiles/thumb.jpg" lat="" lng="" heading="">

    <view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />

    <preview url="panos/69_Jaguar_XKE.tiles/preview.jpg" />

    <image type="CUBE" multires="true" tilesize="512" progressive="false">
    <level tiledimagewidth="2345" tiledimageheight="2345">
    <cube url="panos/69_Jaguar_XKE.tiles/l3_%s_%v_%h.jpg" />
    </level>
    <level tiledimagewidth="1173" tiledimageheight="1173">
    <cube url="panos/69_Jaguar_XKE.tiles/l2_%s_%v_%h.jpg" />
    </level>
    <level tiledimagewidth="587" tiledimageheight="587">
    <cube url="panos/69_Jaguar_XKE.tiles/l1_%s_%v_%h.jpg" />
    </level>
    <mobile>
    <cube url="panos/69_Jaguar_XKE.tiles/mobile_%s.jpg" />
    </mobile>
    </image>


    <plugin name="logo5" url="overview2.png" align="righttop" x="35" y="150" onclick="newScene(get(previousScene))"/>

    </scene>

  • I always write posts so fast that there some mistakes in the code.

    instead of:

    Code
    loadscene(loadscene(%1, null, MERGE, BLEND(1)));

    should be:

    Code
    loadscene(%1, null, MERGE, BLEND(1));

    But I always say, I do not give working codes, just ideas. There is also one more thing you need to remember: when you load panorama for the first time, copy function (copy(previousScene, activescene);) copies null value (because activePano is not set). So you can set it to activepano too.

    Code
    if (activePano == null,
        set(previousPano, %1);
        ,
        copy(previousPano, activePano);
    );

    I watched your code and I cannot see any calling of newScene function except for an attempt to loading previous panorama. And you gave only a part of the code. I guess loading function (onclick action) is in the skin_hotspotstyle style definition. So it shouldn't work unles you change it.

  • Hi!
    you give me an idea!!!!
    to make code or plugin for browsing panos
    "back" "forward" like in browser

    for example you have 0 1 2 3 4 5 6 scenes
    first scene is 0
    you go by hotspot to scene 2 so, prev scene will be 0 and current 2 next you fo to scene 6 then
    previous scene will be 0 and 2 and current 6
    so, if I click on prev/back then you go to 2 scene click on back again and you goto 0 scene
    and 2 and 6 will be "forward" / next panos
    Hope it's clear :)
    Yeah, i think it great idea!!!! *thumbsup*


    Regards,

    Andrey *thumbup*

  • I don't think this solution is a good idea for creating complex history system (like javascript history object). It's 'one-level' solution. But what if you want to click "back" button a few times? A client of mine asked me about creating such system. I didn't do it because I think it's completely unnecesary (if you have hotspots and thumbnail). But If I were to create such a system, I would use arrays (xml objects) to storing list of watched panoramas or use KRPano pop, push functions to store the data in the stack.

  • Done. In the calling scene I have (name changes per scene)


    <action name="PrevScene">
    set(PrevScene,scene_04_Ken_Austins_car_Collection);
    loadscene(get(PrevScene), null, MERGE);
    delete(PrevScene)
    </action>

    Then in the called scene I have


    <plugin
    name="backbutton" url="museum.png" align="righttop" x="25" y="150"
    width="" height="prop" onclick="PrevScene();"/>


    Here is the old tour which nobody actually explored http://rhmpano.com/tours/kenaustincars1

    here is the new tour I hope does get explored http://rhmpano.com/tours/kenaustincars2

Participate now!

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