Conditions for loading a pano.

  • Hello, I am wondering if there is a way to retrieve the current pano scene number through the interface object. I am working on a thumbnail slider, and when you click on a thumbnail of a tour that is already loaded, it loads it again. I am looking for some kind of condition that says for example...

    if(requested pano is the same as currently loaded pano)
    do nothing
    else
    load requested pano

    This is mock up code obviously just to show the idea. I was looking for some way to do it with the loadscene() or loadpano() functions, but couldn't come to a solution. Perhaps even making an action for this in the xml . All suggestions are very much appreciated!

    Thanks! BoriZor

  • Hey Andrey,

    Thanks for the suggestion, I understand what your saying but unfortunately am having some trouble implementing it. This is the piece of code where I just want to output the current scene when a thumb is pressed. My compiler is saying that both "xml" and method "get" are undefined. Should "xml" be the name of my xml file? Should I retrieve it by putting it in a "krpano.call()" function?

    var krpano : krpano_as3_interface = null;
    krpano = krpano_as3_interface.getInstance();
    var scene:Object = krpano.get("scene");
    var showing:String = scene[get(xml.scene)].index;
    trace(showing);

    Your help is very much appreciated.

    Thanks! //Bryan

  • Hi,

    don't mix up krpano xml code and as3 code,

    if you want it simple - try this code:

    var krpano : krpano_as3_interface = null;
    krpano = krpano_as3_interface.getInstance();
    var showing:String = krpano.get("scene[get(xml.scene)].index");
    trace(showing);


    or if you want more information about each step and work in as3:

    Code
    var current_scene_name:String = krpano.get("xml.scene");
    var scene_array:Object = krpano.get("scene");
    var scene_item:Object = scene_array.getItem(current_scene_name);
    if(scene_item != null)
    {
      var scene_item_index:int = scene_item.index;
      trace(scene_item_index);
    }

    see here the documentation about the as3-representation of the krpano objects and array:
    https://krpano.com/docu/plugininterface/#plugininterface

    btw - for new plugins I would recommend not using the "krpano_as3_interface.as" anymore, but instead the new plugin structure with the "registerplugin" entry as plugin start, see the link above for details,

    best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!