Posts by TN421
-
-
Hi,
can you show your example? (link?)
Replied with an example here:
http://www.krpano.com/forum/wbb/inde…20870#post20870/TN
-
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:
Quote"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
HTML
Display More<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
Code
Display More<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 :)
-
Hi Michel,
Thanks for the quick reply. I know the js-function's name is js_showtext, but if I understand correctly it has nothing to do with the krpano action called showtext. It also doesn't work with other javascript function's that have other names. I believe the problem is with the js()-action in krpanoJS. Actually I can't use any javascript function with or without parameters in onclick of hotspots for krpanoJS. They all throw the same error.
BTW I'm only using it in the "demo mode" because I don't have the licence for it yet.
-
I'm using Javascript Interface documented in here and I'm using:
- the js-action
- and image-hotspots created dynamically with javascript
- and onclick function similar to js_showtext() shown here
- but my js_showtext()-function requires parameters eq js_showtext(header, text)
It seems that the krpanoJS isn't able to have a js-function in onclick if the javascript function has parameters. It throws an error on Safari's Error console:QuoteTypeError: Result of expression 'J[a[_[106]]]' [undefined] is not an object.
Regular Flash-version works fine. What should I try? Is this a bug or a feature not ready yet?