Hi, you have replaced the native hotspot style and the "tooltip" value is empty.
You wrote your code in "onloaded", and in the native one, this attribute was used to set the scene signature in "tooltip"
Working code example
|
Quellcode
|
1
2
|
copy(layer[get(tooltipname)].html, scene[get(linkedscene)].title);
</action>
|
Thank you so far, I see part of what failed here, but wouldn't the last line of your example fetch the title of the scene the hotspot points to and use it as the permanently visible tooltip ? So the question for me remains, how I, out of that scope, fetch the hotspots attributes like its name ? Just hotspot.name from the scope of the action ?
when the xml is parsed
the styles get applied to the hotspots / layers etc
all attributes of the style that are not set in the hotspot / layer will be copied over.
like this you can overwrite (or ignore) a style attribute by setting it in the hotspot / layer.
after this process the style gets irrelevant,
eg changing a style dynamically will not update the hotspots / layers!
This is what I believed, the problem should lie here, as I dont think anything happens dynamically. The scene gets loaded, with it the hotspots with its attributes, the referenced style gets looked up and values copied, including the action and the action, when called, which is after loading, should be performed, where it will fetch the relevant values from the hotspot it is part of. The action should (?) run in the scope of its hotspot and thus there should not be a problem with several actions of the same name being performed with different parameters in one scene (?).
but you can also dynamically assign a style
https://krpano.com/docu/actions/#assignstyle
so, to simplify your atttooltip() you could add a style "tooltipstyle" for your tooltips and do
assignstyle(layer[get(tooltipname)], "tooltipstyle");
(or use the set() syntax like in San7 suggested)
actions like onclick will executed in the scope of the layer / hotspot
<hotspot name="test" onclick="trace(name);" /> will trace "test"
Much like assumed, so
<scene name ="scene1">
<hotspot name="hotspot1" onclick="action1" onloaded="action2" />
<hotspot name="hotspot2" onclick="action1" onloaded="action2" />
</scene>
should be able to perform 2 actions of the action1 and action2 type, despite running in the same scene, because they are running in their hotspot, meaning if they took "hotspot1" and "hotspot2" as arguments they would produce different results, isn't it ?
EDIT:
It was simpler than I thought. From the action, despite it having a
|
Quellcode
|
1
|
name="atttooltip"
|
attribute I could fetch the hotspots name attribute by merely using
|
Quellcode
|
1
|
name
|
.
|
Quellcode
|
1
2
3
4
|
<action name="atttooltip">
...
copy(layer[get(tooltipname)].html, name);
</action>
|
The same works when I give the hotspot a custom parameter and call it. I have no idea why. But it works for now.