Hi
Recently I have started to experiement with plugin development.
Getting the sample plugin code from the plugin interface page to work was easy, but when I tried to add my own code which should add some event listeners with krpano.events.addListener("onviewchanged",onviewchangedhandler) in the registerplugin function I cant get it to work.
Firefox always shows the following error message in the console: Uncaught TypeError: krpano.events.addListener is not a function
local.registerplugin = function(krpanointerface, pluginpath, pluginobject)
{
// get the krpano interface and the plugin object
krpano = krpanointerface;
plugin = pluginobject;
krpano.actions.showlog();
krpano.trace(1, "registering plugin [" + plugin.name + "]");
krpano.events.addListener("onviewchanged",onviewchangedhandler);
}
function onviewchangedhandler(evnt) {
krpano.trace("view changed");
};
Display More
What is wrong resp. how can add listeners for the events in krpano.events (basically those that are available with <event xxxx="func()"/>) ?
I guess krpano.events is not fully initialized when I try to register for the event, but IDK how to work around this so I can add the listener later.
In the end, I want to build a plugin which sets some properties for the hotspots in the scene after loading (I gues that would be the onnewpano event) and which can also update some hotspot properties when the view changes.