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.

michel

Professional

  • "michel" started this thread

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

1

Monday, November 15th 2010, 5:37pm

--- just an atached file for a post inside krpano 1.0.8.12 thread ---

Hi Hi TN421,

Here the modified js_showtext example mentioned here (the javascript3 example that come inside krpano 1.0.7)...
javascript3.zip
You have to Copy/Past the javascript3 folder inside the krpano-1.0.8.12-2010-11-09\examples\javascript-interface folder to make it work correctly...

Hope this help...

SAlut.

michel

Professional

  • "michel" started this thread

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Tuesday, November 16th 2010, 3:25am

Hi,

So, I have tried the javascript3 code above on Firefox, Google Chrome, IE, and Safari (normal mode (so, flash) and user agent Mobile Safari 3.2.2 - iPad mode (so, html5)) and it seems to work correctly in all of them...

But, I have tried an other embedding methode as createPanoViewer instead of createswf...

Source code

1
2
3
4
5
6
7
8
9
<script>

  var viewer = createPanoViewer({swf:"../../../krpano.swf",target:"krpanoDIV",id:"krpanoSWFObject",height:"350"});
  viewer.addVariable("xml", "javascript3.xml");
  viewer.addParam("WMODE","transparent");
  //viewer.useHTML5("whenpossible");
  viewer.embed();
  
</script>

With this method, Google Chrome, IE, and Safari (normal mode (so, flash)) does not work correctly.... the zIndex=1000 seems to be ignored and the textinfo appears behind the pano (I have added an height:"350" to make it visible)... in Firefox and Safari (in user agent Mobile Safari 3.2.2 - iPad mode) it works...

I do not understand what it can be *sad* ...

SAlut...

3

Wednesday, November 17th 2010, 11:35am

Hi,

thanks for this note!
that's a bug in the createPanoViewer function,
it doesn't pass the addParam() parameters,
will be fixed with the next release,

best regards,
Klaus

4

Monday, November 22nd 2010, 5:33pm

Hi michel and Klaus,

I've managed to create an example test-case for my problem. Sorry that it took so long time, but my implementation is a complex mixture of PHP, MySQL, Javascript, Flash and KRPano and using it wouldn't have been helpful at all.

It seems the problem is with dynamically created hotspots by javascript and using the js()-function as onclick attribute. When I test it with Safari/Mac/ iPad or iPhone mode, it throws the error:

Quoted

"TypeError: Result of expression 'J[a[_[106]]]' [undefined] is not an object."

Can you michel show what I'm doing wrong or prove me correct with these two example files:
  • javascript4.html
  • javascript4.xml

Insert them to the same folder as you javascript3.html and javascript3.xml were.

Code for javascript4.html

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<html>
<head>
	<title>krpano.com Javascript 4 example</title>
</head>
<style>
body{ font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#FFFFFF; background-color:#000000; margin:0; padding:0; }
* html, * html body{ overflow: hidden; }
a{ color:#555555; text-decoration:underline; }
a:hover{ color:#AAAAAA; text-decoration:underline; }
</style>
<body>

<div id="krpanoDIV">
	<noscript><table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br><br>Javascript not activated<br><br></center></td></tr></table></noscript>
</div>


<div id="textinfo" 
     style="display:none; border:1px solid black; position:fixed; overflow:auto; background-color:#FFFFFF; color:#000000; font-size:14px;"
     onclick="js_hidetext()">
     <center>
		<h3>html text</h3><br>
		<br>
		this is a html div element<br>
		<br>
		click to close<br>
		<br>
		<br>
		test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br> 
		<br>
		<img src="pano1_small.jpg" />
		
	</center>
</div>



<script src="../../../swfkrpano.js"></script>

<script>

  var swf = createswf("../../../krpano.swf","krpanoSWFObject");
  swf.addVariable("xml", "javascript4.xml");
  swf.addParam("wmode", "transparent");
  swf.embed("krpanoDIV");
</script>

<script>
// <![CDATA[




	//embedpano({swf:"../../../krpano.swf", id:"krpanoSWFObject", xml:"javascript3.xml", target:"krpanoDIV", width:"516"});

	function krpano() 
	{
		return document.getElementById("krpanoSWFObject");
	}
    
	function loadpano(xmlname)
	{
		krpano().call("loadpano(" + xmlname + ", null, MERGE, BLEND(1));");
	}
	
// ]]>
</script>


<script type="text/javascript">
// <![CDATA[



	function js_showtext( txt )
	{
	
	    document.title = txt;
	
		var krpano = document.getElementById("krpanoSWFObject");
		krpano.style.zIndex  = "0";
	
		var to = document.getElementById("textinfo");
	
		to.style.display = "block";
	
		
			to.style.position = "absolute";
		
		
		to.style.zIndex  = "1000";
		to.style.left   = "25%";
		to.style.top    = "15%";
		to.style.width  = "50%";
		to.style.height = "70%";
	}
	
	function js_hidetext()
	{
		var to = document.getElementById("textinfo");
		to.style.display = "none";
		
		var krpano = document.getElementById("krpanoSWFObject");
		self.focus();
		krpano.focus();
	}
	
	function js_addHotspot()
	{
	
		var spotname = "spot1";
	
		var str = "";
		str += "addhotspot(" + spotname + ");";
		str += "set(hotspot[" + spotname + "].url,../../../examples/javascript-interface/js-loadpano/thumb1.jpg);";
		str += "set(hotspot[" + spotname + "].ath,0);";
		str += "set(hotspot[" + spotname + "].atv,0);";
		str += "set(hotspot[" + spotname + "].scale,1.0);";
		str += "set(hotspot[" + spotname + "].alpha,1.0);";
		str += "set(hotspot[" + spotname + "].distorted,false);";
		str += "set(hotspot[" + spotname + "].zoom,true);";
		str += "set(hotspot[" + spotname + "].capture,false);";
		str += "set(hotspot[" + spotname + "].onhover,showtext(I'm not functioning properly));";
		str += "set(hotspot[" + spotname + "].onclick,js(js_showtext()));";
		krpano().call(str);
	}
	
// ]]>
</script>

</body>
</html>


Code for javascript4.xml

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
<krpano version="1.0.8">

    <!-- use only a grid preview pano to save download space ;-) -->
    <preview type="grid(cube,50,50,400,0xCCCCCC,0x999999,0xFFFFFF);" details="16" />

    <!--<preview url="spherepreview.jpg" />
    <image type="SPHERE">
        <sphere url="sphere_example.jpg" />
    </image>-->
               
    <hotspot name="autoid0" visible="true" url="../../../examples/javascript-interface/js-loadpano/thumb1.jpg" ath="40" atv="15"
        fillcolor     ="0xffffff" fillalpha     ="0.10" borderwidth     ="2.0" bordercolor     ="0xffffff" borderalpha     ="0.40"
        fillcolorhover="0xffffff" fillalphahover="0.50" borderwidthhover="4.0" bordercolorhover="0xffffff" borderalphahover="0.80"
        fadeintime="0.150" fadeouttime="0.300" fadeincurve="1.100" fadeoutcurve="0.700"
        onhover="showtext(js_showtext())"
        onclick="js(js_addHotspot);"
        >
        <point ath=" 22.8605" atv=" -6.3398" />
        <point ath=" 23.1256" atv="  9.1305" />
        <point ath=" 45.6471" atv="  7.9887" />
        <point ath=" 44.7655" atv=" -6.1559" />
        <point ath=" 33.5826" atv=" -8.6019" />
    </hotspot>               

</krpano>


Thanks again! I hope we can solve this thing together soon :)

michel

Professional

  • "michel" started this thread

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

5

Monday, November 22nd 2010, 6:56pm

Hi TN421,

It seems that the problem comes from the name of the function js_addHotspot() *confused* ...
I have tried other names that have resulted to the same error (but I have no idea of why this happens)...
Finally, I have named the function as js_hsaad() and it worked *smile* ...

Hope this help...

SAlut.

6

Monday, November 22nd 2010, 8:23pm

Hi,

thanks for this note!
it's a case bug!

internally the name of the called javascript function was converted to lowercase,
that means at the moment only lower case javascript functions can be called,

this will be fixed in the next release and there will be also an additional checking
if the to be called javascript functions even exists,

best regards,
Klaus

7

Monday, November 22nd 2010, 10:07pm

Thanks a million guys!

I will be able to solve this now. Didn't cross my mind it could be about the case :)

8

Wednesday, November 24th 2010, 3:46pm

Hi,

there is a new version out where the case bug is fixed,

best regards,
Klaus