I see that I can access a specific scene's nodes and attributes with "scene[scenename].xxx", but I can't figure out how to access attributes (such as name) or nodes (such as data) for the current scene. Is there any way to do this?
How do I access current scene attributes and nodes?
-
-
Hi,
<scene> is special node in the xml,
only this three values can be accessed/read:- scene[name].name
- scene[name].content
- scene[name].onstart
best regards,
Klaus -
Hi, this restriction is valid also with new krpano version? no read - no acces also for this atributes?
thumburl
lat
lng
heading -
Hi guys! Sorry if I understand you wrong about "get/access" for a scene's atributes, but the following stuff seems to work:
the modified "startup action:
Code<action name="startup"> if(startscene === null, copy(startscene,scene[0].name)); loadscene(get(startscene), null, MERGE); set(panonumber,1); </action>
an event to trigger a check on every new pano:
and the action itself:
Code
Alles anzeigen<action name="check_pano"> add(panonumber,1); if(panonumber GT 4, set(scene[get(xml.scene)].title, null); set(scene[get(xml.scene)].thumburl, null); set(scene[get(xml.scene)].lat, null); set(scene[get(xml.scene)].lng, null); set(scene[get(xml.scene)].heading, null); ); showlog(); trace(title=,scene[get(xml.scene)].title); trace(thumb=,scene[get(xml.scene)].thumburl); trace(latitude=,scene[get(xml.scene)].lat); trace(longitude=,scene[get(xml.scene)].lng); trace(heading=,scene[get(xml.scene)].heading); </action>
The idea is that after you went through four panoramas, the title, thumburl, latitude, longitude and heading are set to "null". And I see in the log that traces return corresponding values and "nulls" after fourth loaded pano.
-
Hi,
attributes AT the <scene> elements can be accessed!
It's only not possible to access elements or attributes INSIDE the <scene> elements.
The reason therefore is that the content inside the <scene> elements will be not parsed during the xml loading. Instead of parsing the whole <scene> content will be stored as text inside the 'scene[name].content' variable, and only parsed when calling loadscene() for that scene. That means a scene is like an 'inline-xml'.
Best regards,
Klaus -
So if I put a layer inside the <scene> and set keep="false", it will appear only when this scene is loaded? I remember I tried this way some time ago to make different photos appear in various scenes, but I rejected this way, - honestly, don't remember why exactly((
Or, I guess, this layer won't need keep="false"...
-
Right, that layer will appear only in that scene and disapear again when loading another scene/pano because of the keep=false (which right - is already the default and don't need to be set).
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!