You are not logged in.

1

Friday, April 17th 2009, 10:38pm

possibility to count scenes?

Hi Klaus,

first of all:
Congratulations to your superb work!
I did some virt. toursi n the past with tourweaver, started to switch to fpp some month ago but now i am very glad to use krpano in future because of many (!) advanteges against fpp (e.g. the fully documented API)... and ... i again am proud to see this leading software-developement coming from austria, my nativ country (i am living in a village near Wr.Neustadt)!

issue:
The extension of the xml-structure to handle a numebr of scenes is very useful to me: More and more it seems that for my work the use of Actionscript wont be necessary any more (i did this in the past, combining fpp). I know that new features like "scenes" are not yet documented completely, but could you please help me how to get the number of scenes in a variable?

Regards,
Oliver
best regards from www.PanAustria.com

Shanti

Intermediate

Posts: 301

Location: Puerto Vallarta

Occupation: Web Developer

  • Send private message

2

Sunday, April 19th 2009, 8:41pm

just a quick question, can you explain why you need this ? are the scenes loaded dynamically ? by PHP or something similar ?

as you, I don't know the full documentation on scenes, but if you are loading them dynamically you could use a for loop in php and get the number of scenes this way and print it to any variable.

3

Sunday, April 19th 2009, 11:12pm

i am looking for the max-possibilities of the scripting language for not to use flash or anything else...
So one issue is: if i have the same pano-naming in all my tours it would be helpful to have my preview-buttons for scene-selection generated automatically. Therefor it is necessary to get the number of scenes used in the xml into some xml-variable...
best regards from www.PanAustria.com

4

Monday, April 20th 2009, 2:16pm

OK - i´ve got it ---->
for everybody who is interested in how to get the number of used scenes:

not (yet) documented but simple use

Source code

1
trace(Numbers of loaded scenes: ,scene.count)
best regards from www.PanAustria.com

5

Monday, April 20th 2009, 10:26pm

Hi,

every XML element with a "name" attribute will become an internal "Array",
and the number of the elements can be get via ".count"

e.g.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
<plugin name="p1" />
<plugin name="p2" />
<hotspot name="h1" />
<hotspot name="h2" />
<usertag name="u1" />
<usertag name="u2" />

...

trace(plugin.count);
trace(hotspot.count);
trace(usertag.count);


one more note - to access these elements from AS3:
instead of the "name" also a numeric index can be used,
e.g.
AS3:

Source code

1
2
3
4
5
6
var number_of_hotspots:int = krpano.get("hotspot.count");
var i:int;
for (i=0; i<number_of_hotspots; i++)
{
  var hotspot:* = krpano.get("hotspot[" + i + "]");
}


best regards,
Klaus