You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, February 19th 2017, 8:05pm

addhotspot?

is this supposed to actually add a hotspot? for example if I click a button it will add a new hotspot to the scene?


addhotspot(newspot);
set(hotspot[newspot].url,spot.png);
set(hotspot[newspot].ath,150);
set(hotspot[newspot].atv,30);
set(hotspot[newspot].scale,0.7);
set(hotspot[newspot].zoom,true);
set(hotspot[newspot].onclick, removehotspot(newspot) );
I tried to use this example from the documentation and I cannot get it to work. I keep getting:
"ERROR: hotspot[newspot] - loading of 'hotspot.png' failed!"
this is the action that I am calling. The image is in the right spot because I am using it in the same scene for hotspots not created dynamically


<action name="addhot2spot">
addhotspot(newspot);
set(hotspot[newspot].url,hotspot.png);
set(hotspot[newspot].ath,150);
set(hotspot[newspot].atv,30);
set(hotspot[newspot].scale,0.7);
set(hotspot[newspot].zoom,true);

</action>

and then something like: onclick="addhot2spot();"


can you point me to a good example of adding a hotspot dynamically?
Thank you *smile*


spacerywirtualne

Professional

Posts: 1,005

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

2

Monday, February 20th 2017, 9:55am

Hi

The path to the file is ok? (hotspot.png)

Kind regards

Piotr
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube

cms4vr team *thumbsup*

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

3

Monday, February 20th 2017, 4:12pm

As clearly stated in your error log path to image is not correct. As you are not using path placeholders take care that path to image file is relative to xml file where your action is started.
Or you save image to same folder where xml file is or use e.g.
set(hotspot[newspot].url,'%SWFPATH%/folder_where_image_is_stored/your_file.png');

This post has been edited 1 times, last edit by "Umalo" (Feb 23rd 2017, 3:49pm)


4

Wednesday, February 22nd 2017, 8:47pm

That did not work.

Thank you for your response
The path was ok and I did have the image in the same folder as the xml .

I am using the draggable hotspots example. I'm thinking that when I click on "spot3" it will call "addhot2spot" and a new hotspot will be created named "newspot"? I always get " hotspot[newspot] - loading of './hotspot.png' failed! "

I also tried all of the following
set(hotspot[newspot].url,'%SWFPATH%/hotspot.png');
set(hotspot[newspot].url,%SWFPATH%/hotspot.png);
set(hotspot[newspot].url,%SWFPATH%/"hotspot.png");
set(hotspot[newspot].url,"hotspot.png");
set(hotspot[newspot].url,hotspot.png);

and also moved it to an images folder and tried all the above combos with that path;
set(hotspot[newspot].url,'%SWFPATH%/images/hotspot.png');


Here is the code, it is just the dragable hotspots with an action to create a hotspot.

<action name="addhot2spot">
addhotspot(newspot);
set(hotspot[newspot].url,"hotspot.png");
set(hotspot[newspot].ath,50);
set(hotspot[newspot].atv,-25);
set(hotspot[newspot].scale,0.7);
set(hotspot[newspot].zoom,true);

</action>



<hotspot name="spot2" url="hotspot.png" zoom="true" scale="0.5" ath="0" atv="+25" ondown="draghotspot();" />


<hotspot name="spot3" url="hotspot.png" distorted="true" scale="0.5" ath="+25" atv="+5" ondown="addhot2spot();" />
<hotspot name="newspot2" url="hotspot.png" scale="0.5" ath="-25" atv="+29" ondown="draghotspot();" onclick="addhot2spot();" />
jprucey has attached the following images:
  • draggable.png
  • loadingFailed.png
  • filePath.png

spacerywirtualne

Professional

Posts: 1,005

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

5

Wednesday, February 22nd 2017, 9:13pm

It must work.

If the file is in the same location as the main xml then try.

<action name="addhot2spot">
addhotspot(newspot);
set(hotspot[newspot].url,hotspot.png);
...
</action>


or

<action name="addhot2spot">
addhotspot(newspot);
set(hotspot[newspot].url,%FIRSTXML%hotspot.png);
...
</action>


best regards
Piotr
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube

cms4vr team *thumbsup*

6

Wednesday, February 22nd 2017, 10:42pm

Thank you spacerywirtualne

Thank you *smile*

That worked (%FIRSTXML%)

I wish I understood why all the others did not, especially since that's how they are in the docs and I've seen examples posted on the form without that.

from docs, doesn't work:

addhotspot(newspot);
set(hotspot[newspot].url,spot.png);
set(hotspot[newspot].ath,150);
set(hotspot[newspot].atv,30);
set(hotspot[newspot].scale,0.7);
set(hotspot[newspot].zoom,true);
set(hotspot[newspot].onclick, removehotspot(newspot) );



But that works perfectly.
Thank you so much *smile*

spacerywirtualne

Professional

Posts: 1,005

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

7

Thursday, February 23rd 2017, 2:06pm

Thank you so much
You're welcome!


kind regards
Piotr
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube

cms4vr team *thumbsup*