You are not logged in.

1

Wednesday, October 5th 2011, 6:53pm

krpano().call is not a function

I have a problem to call the krpano().call(..) method when I include the jQuery Mobile library (http://code.jquery.com/mobile/1.0rc1/jqu…e-1.0rc1.min.js).

The browser console said: "krpano().call is not a function". Works perfectly with krpanoJS.

My goal is to load a new pano as shown below: "krpano.call("loadpano('pano2.xml')");"
Unfortunately when I introduce the pagination with JQM, the browser console returns me the error.

Is it possible that I mistake something? Thanks.

This post has been edited 1 times, last edit by "ranone" (Oct 5th 2011, 7:12pm)


mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

2

Thursday, October 6th 2011, 2:49am

Make shore that you wrote code correctkrpano().call(..) - not right
krpano.call(..) - right



And if you test your code localy - this is not work becouse security error
go to
http://www.macromedia.com/support/docume…_manager04.html
and add you krpano.swf or folder to secure list


Hope it help


Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

3

Thursday, October 6th 2011, 10:07am

I tested it correctly, I have the whole project in the secure list of Flash Player. It still does not work.

Any suggestions?

4

Thursday, October 6th 2011, 4:20pm

Hi,

that can be timing error - the call function is only there when the viewer itself was already embedded and loaded,
either check for the "call" function via a Timer (setInterval or setTimeout) or make a call from xml back to js to notify the javascript that the viewer is loaded and ready for calls,

beside of this - when using the kprotect tool - then make sure that the Javascript Interface is not disabled there,

best regards,
Klaus

Zephyr

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

5

Saturday, October 8th 2011, 4:58pm

a document ready doesnt mean that krpano is ready. Krpano should trigger your script, not the dom.

<krpano onstart="js(krpano_ready())" >

and krpano_ready would be a function that initiazis your javasvcript (for isntance binding elements with the onclick $(".button").click(function(){ krpano().call("trace(click)");});)

alsoo what does krpano() do? return a DOM object of krpano?

6

Tuesday, October 11th 2011, 11:58am

Below I report my code. When I click to change the pano, krpano is an "HTMLEmbedElement object" and the browser console returns the error.

I load the first pano immediately (here no problem); after when there is a request for a pano switching I invoke the "krpano.call()" method that load a new pano and jQuery Mobile does the rest with paging (here the error occur).

In html page:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
	[...]

	<div data-role="page" id="panos">
		<div data-role="content">
			<ul data-role="listview">
				<li><a href="#pano" data-pano="pano1" target="_self">Pano 1</a></li>
				<li><a href="#pano" data-pano="pano2" target="_self">Pano 2</a></li>
			</ul>
		</div>
	</div> 

	<div data-role="page" id="pano" class="panoDiv">
   		<script>
		// <![CDATA[
			createPanoViewer({ swf: 'krpano.swf', xml: 'pano1.xml', target: 'pano' }).embed();
		// ]]>
		</script>
	</div>

	[...]


In javascript file:

Source code

1
2
3
4
5
6
7
8
9
	[...]

	// prepare the click event for the pano switching
	jQuery('#panoDiv ul[data-role="listview"] a').click(function() {
		var name = jQuery(this).attr('data-pano');
		krpano.call("loadpano(name+'.xml')");
	});

	[...]