You are not logged in.

1

Tuesday, January 10th 2012, 3:21pm

Javascript plugin - is there a full example?

I would like to call javascript function from krpano. I follow the documentation: http://krpano.com/docu/plugininterface/#js , with no luck. I do not see an example in krpano distribution that demonstrates this functionality.

Bear with me, I am Javascripts begginer:
1) Should the plugintemplate.js work on IE8?
2) Where do I place the javascript code? Could I just add it to the krpano generated html like this:

<script type="text/javascript">
var swf = createswf("krpano.swf", "krpanoSWFObject", "100%", "100%");
swf.addVariable("xml", "Citysmall.xml");
swf.embed("krpanoDIV");

var krpanoplugin = function()
{
var local = this;
var krpano = null;
var plugin = null;
local.registerplugin = function(krpanointerface, pluginpath, pluginobject)
{
krpano = krpanointerface;
krpano.trace("hello from plugin.");
}
function fun()
{
krpano.trace(1,"fun called");
}
};

The code above does no work for me on IE8. The "registerplugin" is never called. Also, I cannot get the function "fun" called from krpano. *cursing*

Zephyr

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Tuesday, January 10th 2012, 3:42pm

Hi, the javascirpt plugin should be a javascript plugin ;)

in other words:

<plugin url="the_flash_plugin.swf" alturl="alternative_js_plugin.js" />

or <plugin url="js_plugin.js" devices="ipad" />

there you can use: http://krpano.com/docu/plugininterface/#js

But this ofcourse wont work on IE8. Js plugins only work on browsers that support the krpano jsviewer like the ipad, safari or chrome. Which means, if you build a great plugin, you have to create an exact same version for desktop users.

3

Tuesday, January 10th 2012, 5:19pm

Thanks for the clarification. The confusing part is that krpano distribution contains "javascript-interface" demos that works fine on IE8. Because of that, I was convinced the javascript plugin should work as well. OK, time to learn Flash.

4

Thursday, January 12th 2012, 3:03pm

Hi,

you probably mean that - the Javascript Interface (and not the Plugin Interface)
http://krpano.com/docu/js/

and for calling from xml to HTML/JS the js() action can be used:
http://krpano.com/docu/actions/#js

this both interfaces are working the same for Flash and HTML5,

best regards,
Klaus