You are not logged in.

1

Monday, October 24th 2011, 1:39pm

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

mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

2

Monday, October 24th 2011, 2:55pm

Hi!it's simple
xml.scene - has current scene name
scene[get(xml.scene)].index - has current scene index

Hope it help

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

3

Wednesday, October 26th 2011, 11:17am

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

4

Thursday, October 27th 2011, 1:31pm

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:

Source code

1
2
3
4
5
6
7
8
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:
http://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