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.

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

1

Monday, November 28th 2011, 6:16pm

hotspot dynamic url onclick attributes

Hi all ^^
I'm making a tour, and would like to isolate the hotspot openurl links so that the client is able to change it himself,
but I can't get it working, here's what I've done :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<krpano version="1.0.8.14" onstart="startup();">

<action name="startup">
	sethotspotlinks();
</action>

<hotspot name="hotspot1"  onclick="" />

<hotspot name="hotspot2"  onclick="" />
	
<action name="sethotspotlinks">
	set(hotspot1[onclick].openurl('http://www.eboovisite.com', _self);
	set(hotspot2[onclick].openurl('http://www.eboovisite.com/iPhone',_self);
</action>


As far as know it should be working but it isn't, I must've forget something :'(
I'll take any idea or suggestion on that ^^
Thanks in advance !
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Monday, November 28th 2011, 6:19pm

completely kludged up the syntax :)

set(hotspot[hotspot1].onclick,'openurl(http://www.eboovisite.com, _self)');

or something close..
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

3

Monday, November 28th 2011, 6:30pm

LOL XD
Very tired tonight !! ;-)
I am ashamed of myself !
Ok thanks for the fast reply and sorry for this useless message ^^
I think I'll go home now !!
Regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

4

Friday, December 2nd 2011, 1:09pm

Up please I'm blocked again :'(

Hi again !
Furthur in this example, I'm trying to copy these hotspots onclick attributes for a onhover image but miss something...
I've searched on the forum and documentation but can solve this :'(
Here's what i'm trying to do :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<krpano version="1.0.8.14" onstart="startup();">

<action name="startup">
	sethotspotlinks();
</action>

<hotspot name="hotspot1"  onover="action(show_hotspot_hover, hotspot1, img/hotspot1_hover.png);  onout="action(hide_hotspot_hover, hotspot1); onclick="" />

<hotspot name="hotspot2"  onover="action(show_hotspot_hover, hotspot2, img/hotspot1_hover.png);  onout="action(hide_hotspot_hover, hotspot2); onclick="" />

	<action name="show_hotspot_hover">
	set(plugin[hotspot_hover].parent, hotspot[%1]);
	set(plugin[hotspot_hover].url, %2);
	set(plugin[hotspot_hover].visible, true);
	tween(plugin[hotspot_hover].alpha, 1.0, 1.0, easeOutCubic);
	</action>

	<action name="hide_hotspot_hover">
	set(plugin[hotspot_hover].visible, false);
	tween(plugin[hotspot_hover].alpha, 0.0, 1.0, easeOutCubic);
	</action>
	
        <action name="sethotspotlinks">
	set(hotspot[hotspot1].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot2].onclick,'openurl(http://www.eboovisite.com, _self)');
         </action>


That works perfectly but I'm blocked on the fact to copy the hotspot.onclick attribute to the hotspot_hover.onclick...
I tried :

Source code

1
copy(hospot[hotspot1].onclick, plugin[hotspot_hover].onclick());


The syntax makes me crazy with those things, I really need to work on that ;-)
Thank you in advance for your help.
Best reagrds.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

5

Friday, December 2nd 2011, 1:13pm

try with out the ()

copy(hospot[hotspot1].onclick, plugin[hotspot_hover].onclick);

the () usually means, execute this code. But in this case you want to reference to the content of the onclick.

and this is pure personal, but I like someaction(parameter1, parameter2) better, then action(someaction, parameter1, parameter2).
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

6

Friday, December 2nd 2011, 1:56pm

Thanks for the reply Zephyr ;-) (This time didn't call you Nupsi ^^ ).
In fact my problem is as you see the hotspot_hover depends on the hotspot onover, so I can't use this syntax, cause if I do all my openurl will send to the same url.
Think i'm obliged in using a if(... and I'm not to that point already :'(

Or can I do something like :

Source code

1
2
3
4
if(hotspot[hotspot_hover].parent, hotspot1,
     set(plugin[hotspot_hover].onclick, get(hotspot[hotspot1].onclick ) );
 );
if...

But that means lots of code for nothing...

Maybe :

Source code

1
set(plugin[hotspot_hover].onclick, get(hotspto[hotspot_hover].parent, onclick ) );


???!!!
Thanks in advance I'm getting sick with those ;-)
Regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

7

Friday, December 2nd 2011, 2:22pm

I made it work with if but I'm not happy cause very much code :-(
Here it is :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	<action name="sethotspotlinks">
	set(hotspot[hotspot1].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot2].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot3].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot4].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot5].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot6].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot7].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot8].onclick,'openurl(http://www.eboovisite.com, _self)');
	set(hotspot[hotspot9].onclick,'openurl(http://www.eboovisite.com, _self)');
	if(hotspot[hotspot_hover].parent, hotspot1,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot2,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot3,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot4,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot5,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot6,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot7,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot8,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	if(hotspot[hotspot_hover].parent, hotspot9,
     	set(plugin[hotspot_hover].onclick, 'openurl(http://www.eboovisite.com, _self)');
 	);
	</action>


As my hotspots are unique, can't use a %1 to call it...
If someone has an idea to clean all taht would be great ^^

Thanks again.
Best regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

8

Friday, December 2nd 2011, 5:17pm

btw there is a typo, its hotspot, not hospot

copy(hotspot[hotspot1].onclick, plugin[hotspot_hover].onclick);

Im not sure what you are trying to do.

You have a normal hotspot, and a hover hotspot, and both have the same url? But the hover hotspot is shared with all the other hotspots? why not make onover action which copies the onclick to the hoverhotspot?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
      <hotspot name="hotspot2"  
		onover="action(show_hotspot_hover, img/hotspot1_hover.png);  
		onout="action(hide_hotspot_hover); 
		onclick="" 
	/>

	<action name="show_hotspot_hover">
		set(plugin[hotspot_hover].parent, hotspot[get(name)]);
		set(plugin[hotspot_hover].url, %1);
		set(plugin[hotspot_hover].visible, true);
		copy(plugin[hotspot_hover].onclick, hotspot[get(name)].onclick);
		tween(plugin[hotspot_hover].alpha, 1.0, 1.0, easeOutCubic);
	</action>

	<action name="hide_hotspot_hover">
		set(plugin[hotspot_hover].visible, false);
		tween(plugin[hotspot_hover].alpha, 0.0, 1.0, easeOutCubic);
	</action>
	
	<action name="sethotspotlinks">
		set(hotspot[hotspot1].onclick,'openurl(http://www.eboovisite.com, _self)');
		set(hotspot[hotspot2].onclick,'openurl(http://www.eboovisite.com, _self)');
	 </action>


here's the cleaned up version. instead of sending hotspot2 as %1, you can use get(name) to get the name of the caller hotspot
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

9

Monday, December 5th 2011, 3:58pm

Thanks a lot for that !!!
Ok now I understand, I was thinking that in other post when I was seeing something like hotspot[get(name)]),
I thought that "name" was for the example !!
That's gonna help me so much !!!!
I'm really going to work on that cause very flexible when well controlled, as Mindlessboss templates for examples.
I would like in the future make a virtual tour template all in javascript, in case of making a complete website using Krpano , without using flash at all.
This might be the start of a new era with 3D websites, neither than old 2D ones ^^
Thanks a lot again !
Best regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Yomas

Intermediate

  • "Yomas" started this thread

Posts: 190

Location: Anglet, France

  • Send private message

10

Monday, December 12th 2011, 12:44pm

Hi again again again ^^
Just one more thing :-)
I get the error (ERROR: no parent "hotspot[get(name)]" found) with the get action for the line :

Source code

1
set(plugin[hotspot_hover].parent, hotspot[get(name)]);


I tried to change by doing:

Source code

1
set(plugin[hotspot_hover].parent, get(name) );

But this gives me the error :
ERROR: no parent "hotspot1" found
ERROR: no parent "hotspot2" found
...
But in fact it's the right parent name *confused*

Maybe a syntax error ?
It works perfectly for the copy(plugin[hotspot_hover].onclick, hotspot[get(name)].onclick); though ^^

Thanks again again again !!
Regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

This post has been edited 1 times, last edit by "Yomas" (Dec 12th 2011, 1:27pm)


Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

11

Monday, December 12th 2011, 2:00pm

this:

Source code

1
set(plugin[hotspot_hover].parent, hotspot[get(name)]);


Will get the hotspot object. Best way is just use the get(name)

the other approach should work... Is hotspot1 and hotspot2 above hotspot_hover in your code? Sometimes putting parents below the child gives errors.
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).